ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Matthew Treinish | 481466b | 2012-12-20 17:16:01 -0500 | [diff] [blame] | 16 | from tempest import clients |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 17 | from tempest.common.utils import data_utils |
Chris Yeoh | 01cb279 | 2013-02-09 22:25:37 +1030 | [diff] [blame] | 18 | from tempest.test import attr |
Giulio Fidente | 83181a9 | 2013-10-01 06:02:24 +0200 | [diff] [blame] | 19 | from tempest.test import skip_because |
Sean Dague | 09761f6 | 2013-05-13 15:20:40 -0400 | [diff] [blame] | 20 | from tempest.thirdparty.boto.test import BotoTestCase |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 21 | |
| 22 | |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 23 | class S3BucketsTest(BotoTestCase): |
| 24 | |
| 25 | @classmethod |
| 26 | def setUpClass(cls): |
| 27 | super(S3BucketsTest, cls).setUpClass() |
Matthew Treinish | 481466b | 2012-12-20 17:16:01 -0500 | [diff] [blame] | 28 | cls.os = clients.Manager() |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 29 | cls.client = cls.os.s3_client |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 30 | |
Giulio Fidente | 83181a9 | 2013-10-01 06:02:24 +0200 | [diff] [blame] | 31 | @skip_because(bug="1076965") |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 32 | @attr(type='smoke') |
| 33 | def test_create_and_get_delete_bucket(self): |
Sean Dague | 64ef48d | 2013-01-03 17:54:36 -0500 | [diff] [blame] | 34 | # S3 Create, get and delete bucket |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 35 | bucket_name = data_utils.rand_name("s3bucket-") |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 36 | cleanup_key = self.addResourceCleanUp(self.client.delete_bucket, |
| 37 | bucket_name) |
| 38 | bucket = self.client.create_bucket(bucket_name) |
| 39 | self.assertTrue(bucket.name == bucket_name) |
| 40 | bucket = self.client.get_bucket(bucket_name) |
| 41 | self.assertTrue(bucket.name == bucket_name) |
| 42 | self.client.delete_bucket(bucket_name) |
| 43 | self.assertBotoError(self.s3_error_code.client.NoSuchBucket, |
| 44 | self.client.get_bucket, bucket_name) |
| 45 | self.cancelResourceCleanUp(cleanup_key) |