| OLD | NEW |
| (Empty) | |
| 1 # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. |
| 2 # All rights reserved. |
| 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: |
| 11 # |
| 12 # The above copyright notice and this permission notice shall be included |
| 13 # in all copies or substantial portions of the Software. |
| 14 # |
| 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 # IN THE SOFTWARE. |
| 22 |
| 23 """ |
| 24 Tests for Layer1 of Cloudsearch |
| 25 """ |
| 26 import time |
| 27 |
| 28 from tests.unit import unittest |
| 29 from boto.cloudsearch2.layer1 import CloudSearchConnection |
| 30 from boto.cloudsearch2.layer2 import Layer2 |
| 31 from boto.regioninfo import RegionInfo |
| 32 |
| 33 |
| 34 class CloudSearchLayer1Test(unittest.TestCase): |
| 35 cloudsearch = True |
| 36 |
| 37 def setUp(self): |
| 38 super(CloudSearchLayer1Test, self).setUp() |
| 39 self.layer1 = CloudSearchConnection() |
| 40 self.domain_name = 'test-%d' % int(time.time()) |
| 41 |
| 42 def test_create_domain(self): |
| 43 resp = self.layer1.create_domain(self.domain_name) |
| 44 |
| 45 resp = (resp['CreateDomainResponse'] |
| 46 ['CreateDomainResult'] |
| 47 ['DomainStatus']) |
| 48 |
| 49 self.addCleanup(self.layer1.delete_domain, self.domain_name) |
| 50 self.assertTrue(resp.get('Created', False)) |
| 51 |
| 52 |
| 53 class CloudSearchLayer2Test(unittest.TestCase): |
| 54 cloudsearch = True |
| 55 |
| 56 def setUp(self): |
| 57 super(CloudSearchLayer2Test, self).setUp() |
| 58 self.layer2 = Layer2() |
| 59 self.domain_name = 'test-%d' % int(time.time()) |
| 60 |
| 61 def test_create_domain(self): |
| 62 domain = self.layer2.create_domain(self.domain_name) |
| 63 self.addCleanup(domain.delete) |
| 64 self.assertTrue(domain.created, False) |
| 65 self.assertEqual(domain.domain_name, self.domain_name) |
| 66 |
| 67 def test_initialization_regression(self): |
| 68 us_west_2 = RegionInfo( |
| 69 name='us-west-2', |
| 70 endpoint='cloudsearch.us-west-2.amazonaws.com' |
| 71 ) |
| 72 self.layer2 = Layer2( |
| 73 region=us_west_2, |
| 74 host='cloudsearch.us-west-2.amazonaws.com' |
| 75 ) |
| 76 self.assertEqual( |
| 77 self.layer2.layer1.host, |
| 78 'cloudsearch.us-west-2.amazonaws.com' |
| 79 ) |
| OLD | NEW |