| 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) 2009, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2009, 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 image = rs[0] | 46 image = rs[0] |
| 49 # temporarily make this image runnable by everyone | 47 # temporarily make this image runnable by everyone |
| 50 status = image.set_launch_permissions(group_names=['all']) | 48 status = image.set_launch_permissions(group_names=['all']) |
| 51 assert status | 49 assert status |
| 52 d = image.get_launch_permissions() | 50 d = image.get_launch_permissions() |
| 53 assert d.has_key('groups') | 51 assert d.has_key('groups') |
| 54 assert len(d['groups']) > 0 | 52 assert len(d['groups']) > 0 |
| 55 # now remove that permission | 53 # now remove that permission |
| 56 status = image.remove_launch_permissions(group_names=['all']) | 54 status = image.remove_launch_permissions(group_names=['all']) |
| 57 assert status | 55 assert status |
| 56 time.sleep(10) |
| 58 d = image.get_launch_permissions() | 57 d = image.get_launch_permissions() |
| 59 assert not d.has_key('groups') | 58 assert not d.has_key('groups') |
| 60 | 59 |
| 61 # create 2 new security groups | 60 # create 2 new security groups |
| 62 group1_name = 'test-%d' % int(time.time()) | 61 group1_name = 'test-%d' % int(time.time()) |
| 63 group_desc = 'This is a security group created during unit testing' | 62 group_desc = 'This is a security group created during unit testing' |
| 64 group1 = c.create_security_group(group1_name, group_desc) | 63 group1 = c.create_security_group(group1_name, group_desc) |
| 65 time.sleep(2) | 64 time.sleep(2) |
| 66 group2_name = 'test-%d' % int(time.time()) | 65 group2_name = 'test-%d' % int(time.time()) |
| 67 group_desc = 'This is a security group created during unit testing' | 66 group_desc = 'This is a security group created during unit testing' |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 161 |
| 163 # short test around Paid AMI capability | 162 # short test around Paid AMI capability |
| 164 demo_paid_ami_id = 'ami-bd9d78d4' | 163 demo_paid_ami_id = 'ami-bd9d78d4' |
| 165 demo_paid_ami_product_code = 'A79EC0DB' | 164 demo_paid_ami_product_code = 'A79EC0DB' |
| 166 l = c.get_all_images([demo_paid_ami_id]) | 165 l = c.get_all_images([demo_paid_ami_id]) |
| 167 assert len(l) == 1 | 166 assert len(l) == 1 |
| 168 assert len(l[0].product_codes) == 1 | 167 assert len(l[0].product_codes) == 1 |
| 169 assert l[0].product_codes[0] == demo_paid_ami_product_code | 168 assert l[0].product_codes[0] == demo_paid_ami_product_code |
| 170 | 169 |
| 171 print '--- tests completed ---' | 170 print '--- tests completed ---' |
| OLD | NEW |