OLD | NEW |
1 #!/usr/bin/env python | |
2 | |
3 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ |
4 # Copyright (c) 2010, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. |
5 # All rights reserved. | 3 # All rights reserved. |
6 # | 4 # |
7 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
8 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
9 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
10 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
11 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
12 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
(...skipping 25 matching lines...) Expand all Loading... |
38 def test_1_basic(self): | 36 def test_1_basic(self): |
39 print '--- running SQSConnection tests ---' | 37 print '--- running SQSConnection tests ---' |
40 c = SQSConnection() | 38 c = SQSConnection() |
41 rs = c.get_all_queues() | 39 rs = c.get_all_queues() |
42 num_queues = 0 | 40 num_queues = 0 |
43 for q in rs: | 41 for q in rs: |
44 num_queues += 1 | 42 num_queues += 1 |
45 | 43 |
46 # try illegal name | 44 # try illegal name |
47 try: | 45 try: |
48 queue = c.create_queue('bad_queue_name') | 46 queue = c.create_queue('bad*queue*name') |
| 47 self.fail('queue name should have been bad') |
49 except SQSError: | 48 except SQSError: |
50 pass | 49 pass |
51 | 50 |
52 # now create one that should work and should be unique (i.e. a new one) | 51 # now create one that should work and should be unique (i.e. a new one) |
53 queue_name = 'test%d' % int(time.time()) | 52 queue_name = 'test%d' % int(time.time()) |
54 timeout = 60 | 53 timeout = 60 |
55 queue = c.create_queue(queue_name, timeout) | 54 queue = c.create_queue(queue_name, timeout) |
56 time.sleep(60) | 55 time.sleep(60) |
57 rs = c.get_all_queues() | 56 rs = c.get_all_queues() |
58 i = 0 | 57 i = 0 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 time.sleep(30) | 127 time.sleep(30) |
129 | 128 |
130 m = queue.read() | 129 m = queue.read() |
131 assert m['foo'] == 'bar' | 130 assert m['foo'] == 'bar' |
132 | 131 |
133 # now delete that queue and messages | 132 # now delete that queue and messages |
134 c.delete_queue(queue, True) | 133 c.delete_queue(queue, True) |
135 | 134 |
136 print '--- tests completed ---' | 135 print '--- tests completed ---' |
137 | 136 |
OLD | NEW |