| OLD | NEW |
| 1 # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved | 1 # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| 11 # The above copyright notice and this permission notice shall be included | 11 # The above copyright notice and this permission notice shall be included |
| 12 # in all copies or substantial portions of the Software. | 12 # in all copies or substantial portions of the Software. |
| 13 # | 13 # |
| 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 20 # IN THE SOFTWARE. | 20 # IN THE SOFTWARE. |
| 21 # | 21 # |
| 22 import unittest | 22 import unittest |
| 23 import time | |
| 24 | 23 |
| 25 from boto.exception import JSONResponseError | 24 from boto.exception import JSONResponseError |
| 25 from boto.opsworks import connect_to_region, regions, RegionInfo |
| 26 from boto.opsworks.layer1 import OpsWorksConnection | 26 from boto.opsworks.layer1 import OpsWorksConnection |
| 27 | 27 |
| 28 | 28 |
| 29 class TestOpsWorksConnection(unittest.TestCase): | 29 class TestOpsWorksConnection(unittest.TestCase): |
| 30 opsworks = True |
| 31 |
| 30 def setUp(self): | 32 def setUp(self): |
| 31 self.api = OpsWorksConnection() | 33 self.api = OpsWorksConnection() |
| 32 | 34 |
| 33 def test_describe_stacks(self): | 35 def test_describe_stacks(self): |
| 34 response = self.api.describe_stacks() | 36 response = self.api.describe_stacks() |
| 35 self.assertIn('Stacks', response) | 37 self.assertIn('Stacks', response) |
| 36 | 38 |
| 37 def test_validation_errors(self): | 39 def test_validation_errors(self): |
| 38 with self.assertRaises(JSONResponseError): | 40 with self.assertRaises(JSONResponseError): |
| 39 self.api.create_stack('testbotostack', 'us-east-1', | 41 self.api.create_stack('testbotostack', 'us-east-1', |
| 40 'badarn', 'badarn2') | 42 'badarn', 'badarn2') |
| 43 |
| 44 |
| 45 class TestOpsWorksHelpers(unittest.TestCase): |
| 46 opsworks = True |
| 47 |
| 48 def test_regions(self): |
| 49 response = regions() |
| 50 self.assertIsInstance(response[0], RegionInfo) |
| 51 |
| 52 def test_connect_to_region(self): |
| 53 connection = connect_to_region('us-east-1') |
| 54 self.assertIsInstance(connection, OpsWorksConnection) |
| OLD | NEW |