Skip to content

Commit

Permalink
Fix up test to use client objects in test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesls committed Nov 17, 2014
1 parent 92601ce commit e630f2d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/integration/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,18 +537,16 @@ def setUp(self):
super(TestGetBucketLocationForEUCentral1, self).setUp()
self.bucket_name = 'botocoretest%s-%s' % (
int(time.time()), random.randint(1, 1000))
endpoint = self.service.get_endpoint('eu-central-1')
operation = self.service.get_operation('CreateBucket')
response = operation.call(endpoint, bucket=self.bucket_name,
create_bucket_configuration={'LocationConstraint': 'eu-central-1'})
self.assertEqual(response[0].status_code, 200)
client = self.session.create_client('s3', 'eu-central-1')
client.create_bucket(Bucket=self.bucket_name,
CreateBucketConfiguration={
'LocationConstraint': 'eu-central-1',
})

def tearDown(self):
super(TestGetBucketLocationForEUCentral1, self).tearDown()
endpoint = self.service.get_endpoint('eu-central-1')
operation = self.service.get_operation('DeleteBucket')
response = operation.call(endpoint, bucket=self.bucket_name)
self.assertEqual(response[0].status_code, 204)
client = self.session.create_client('s3', 'eu-central-1')
client.delete_bucket(Bucket=self.bucket_name)

def test_can_get_bucket_location(self):
# Even though the bucket is in eu-central-1, we should still be able to
Expand All @@ -557,7 +555,8 @@ def test_can_get_bucket_location(self):
# Also keep in mind that while this test is useful, it doesn't test
# what happens once DNS propogates which is arguably more interesting,
# as DNS will point us to the eu-central-1 endpoint.
response = operation.call(self.endpoint, Bucket=self.bucket_name)
us_east_1 = self.service.get_endpoint('us-east-1')
response = operation.call(us_east_1, Bucket=self.bucket_name)
self.assertEqual(response[1]['LocationConstraint'], 'eu-central-1')


Expand Down

0 comments on commit e630f2d

Please sign in to comment.