diff options
author | Richard Hawkins <richard.hawkins@rackspace.com> | 2015-02-14 10:19:16 -0600 |
---|---|---|
committer | John Dickinson <me@not.mn> | 2015-04-14 13:14:40 -0700 |
commit | 3c419dfb12f19d31d6685ad76c0cf78d5e28f147 (patch) | |
tree | cd8cff02a67fafb7196719b9d8c4e813708477d9 | |
parent | e910f7e07d05dd2c6ada939d5704c3d4944c24b0 (diff) | |
download | swift-3c419dfb12f19d31d6685ad76c0cf78d5e28f147.tar.gz |
Add additional func tests for TempURLs
Change-Id: I25097c87d0a06c283b8ee5067b840f0a22776369
-rw-r--r-- | test/functional/tests.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/test/functional/tests.py b/test/functional/tests.py index b53b7f5e4..95f168e6e 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -2825,10 +2825,23 @@ class TestContainerTempurlEnv(object): cls.conn, tf.config.get('account', tf.config['username'])) cls.account.delete_containers() + # creating another account and connection + # for ACL tests + config2 = deepcopy(tf.config) + config2['account'] = tf.config['account2'] + config2['username'] = tf.config['username2'] + config2['password'] = tf.config['password2'] + cls.conn2 = Connection(config2) + cls.conn2.authenticate() + cls.account2 = Account( + cls.conn2, config2.get('account', config2['username'])) + cls.account2 = cls.conn2.get_account() + cls.container = cls.account.container(Utils.create_name()) if not cls.container.create({ 'x-container-meta-temp-url-key': cls.tempurl_key, - 'x-container-meta-temp-url-key-2': cls.tempurl_key2}): + 'x-container-meta-temp-url-key-2': cls.tempurl_key2, + 'x-container-read': cls.account2.name}): raise ResponseError(cls.conn.response) cls.obj = cls.container.file(Utils.create_name()) @@ -2971,6 +2984,28 @@ class TestContainerTempurl(Base): parms=parms) self.assert_status([401]) + def test_tempurl_keys_visible_to_account_owner(self): + if not tf.cluster_info.get('tempauth'): + raise SkipTest('TEMP AUTH SPECIFIC TEST') + metadata = self.env.container.info() + self.assertEqual(metadata.get('tempurl_key'), self.env.tempurl_key) + self.assertEqual(metadata.get('tempurl_key2'), self.env.tempurl_key2) + + def test_tempurl_keys_hidden_from_acl_readonly(self): + if not tf.cluster_info.get('tempauth'): + raise SkipTest('TEMP AUTH SPECIFIC TEST') + original_token = self.env.container.conn.storage_token + self.env.container.conn.storage_token = self.env.conn2.storage_token + metadata = self.env.container.info() + self.env.container.conn.storage_token = original_token + + self.assertTrue('tempurl_key' not in metadata, + 'Container TempURL key found, should not be visible ' + 'to readonly ACLs') + self.assertTrue('tempurl_key2' not in metadata, + 'Container TempURL key-2 found, should not be visible ' + 'to readonly ACLs') + class TestContainerTempurlUTF8(Base2, TestContainerTempurl): set_up = False |