]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/tasks/mgr/dashboard/test_rgw.py
import ceph 14.2.5
[ceph.git] / ceph / qa / tasks / mgr / dashboard / test_rgw.py
index b4c0676b0dd6cef7741c59cffdc623b984998cde..34f337f8df37e7ae1288943dcaf85908527fc225 100644 (file)
@@ -114,16 +114,22 @@ class RgwBucketTest(RgwTestCase):
     def setUpClass(cls):
         cls.create_test_user = True
         super(RgwBucketTest, cls).setUpClass()
-        # Create a tenanted user.
+        # Create tenanted users.
         cls._radosgw_admin_cmd([
             'user', 'create', '--tenant', 'testx', '--uid', 'teuth-test-user',
             '--display-name', 'tenanted teuth-test-user'
         ])
+        cls._radosgw_admin_cmd([
+            'user', 'create', '--tenant', 'testx', '--uid', 'teuth-test-user2',
+            '--display-name', 'tenanted teuth-test-user 2'
+        ])
 
     @classmethod
     def tearDownClass(cls):
         cls._radosgw_admin_cmd(
             ['user', 'rm', '--tenant', 'testx', '--uid=teuth-test-user'])
+        cls._radosgw_admin_cmd(
+            ['user', 'rm', '--tenant', 'testx', '--uid=teuth-test-user2'])
         super(RgwBucketTest, cls).tearDownClass()
 
     def test_all(self):
@@ -232,7 +238,22 @@ class RgwBucketTest(RgwTestCase):
         self.assertEqual(data['tenant'], 'testx')
         self.assertEqual(data['bid'], 'testx/teuth-test-bucket')
 
-        # Update the bucket.
+        # Update bucket: different user from same tenant.
+        self._put(
+            '/api/rgw/bucket/{}'.format(
+                urllib.quote_plus('testx/teuth-test-bucket')),
+            params={
+                'bucket_id': data['id'],
+                'uid': 'testx$teuth-test-user2'
+            })
+        self.assertStatus(200)
+        data = self._get('/api/rgw/bucket/{}'.format(
+            urllib.quote_plus('testx/teuth-test-bucket')))
+        self.assertStatus(200)
+        self.assertIn('owner', data)
+        self.assertEqual(data['owner'], 'testx$teuth-test-user2')
+
+        # Update bucket: different user from empty tenant.
         self._put(
             '/api/rgw/bucket/{}'.format(
                 urllib.quote_plus('testx/teuth-test-bucket')),