blob: f8948fd5753d497c3e02b393aae6fef92113fdaa [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Attila Fazekasa23f5002012-10-23 19:32:45 +02002# 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 Treinish481466b2012-12-20 17:16:01 -050016from tempest import clients
Masayuki Igawa259c1132013-10-31 17:48:44 +090017from tempest.common.utils import data_utils
Chris Yeoh01cb2792013-02-09 22:25:37 +103018from tempest.test import attr
Giulio Fidente83181a92013-10-01 06:02:24 +020019from tempest.test import skip_because
Sean Dague09761f62013-05-13 15:20:40 -040020from tempest.thirdparty.boto.test import BotoTestCase
Attila Fazekasa23f5002012-10-23 19:32:45 +020021
22
Attila Fazekasa23f5002012-10-23 19:32:45 +020023class S3BucketsTest(BotoTestCase):
24
25 @classmethod
26 def setUpClass(cls):
27 super(S3BucketsTest, cls).setUpClass()
Matthew Treinish481466b2012-12-20 17:16:01 -050028 cls.os = clients.Manager()
Attila Fazekasa23f5002012-10-23 19:32:45 +020029 cls.client = cls.os.s3_client
Attila Fazekasa23f5002012-10-23 19:32:45 +020030
Giulio Fidente83181a92013-10-01 06:02:24 +020031 @skip_because(bug="1076965")
Attila Fazekasa23f5002012-10-23 19:32:45 +020032 @attr(type='smoke')
33 def test_create_and_get_delete_bucket(self):
Sean Dague64ef48d2013-01-03 17:54:36 -050034 # S3 Create, get and delete bucket
Masayuki Igawa259c1132013-10-31 17:48:44 +090035 bucket_name = data_utils.rand_name("s3bucket-")
Attila Fazekasa23f5002012-10-23 19:32:45 +020036 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)