diff options
| author | Timur Alperovich <timur@timuralp.com> | 2018-11-23 22:47:15 -0800 |
|---|---|---|
| committer | Tim Burke <tim@swiftstack.com> | 2018-11-30 22:58:36 +0000 |
| commit | edfeae372312b3370dc12deea8cd8028ecba6bd6 (patch) | |
| tree | 2c14c732144619423019945132b110be692ecb48 /tests | |
| parent | 8778c91c71e83a40cfeedc4875ae3b66c7effb85 (diff) | |
| download | python-swiftclient-edfeae372312b3370dc12deea8cd8028ecba6bd6.tar.gz | |
Add delimiter to get_account().
Exposes the delimiter parameter, which the Swift API supports for
container listings.
Change-Id: Id8dfce01a9b64de9d1222aab9a4a682ce9e0f2b7
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/functional/test_swiftclient.py | 12 | ||||
| -rw-r--r-- | tests/unit/test_swiftclient.py | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index 1d76a8d..b4f275b 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -154,6 +154,18 @@ class TestFunctional(unittest.TestCase): self.assertTrue(len(containers) >= 1) self.assertEqual(self.containername_2, containers[0].get('name')) + # Test prefix + _, containers = self.conn.get_account(prefix='dne') + self.assertEqual(0, len(containers)) + + # Test delimiter + _, containers = self.conn.get_account( + prefix=self.containername, delimiter='_') + self.assertEqual(2, len(containers)) + self.assertEqual(self.containername, containers[0].get('name')) + self.assertTrue( + self.containername_2.startswith(containers[1].get('subdir'))) + def _check_container_headers(self, headers): self.assertTrue(headers.get('content-length')) self.assertTrue(headers.get('x-container-object-count')) diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py index 62875a5..2d45deb 100644 --- a/tests/unit/test_swiftclient.py +++ b/tests/unit/test_swiftclient.py @@ -704,6 +704,18 @@ class TestGetAccount(MockHttpTest): 'x-auth-token': 'asdf'}), ]) + def test_param_delimiter(self): + c.http_connection = self.fake_http_connection( + 204, + query_string="format=json&delimiter=-") + c.get_account('http://www.test.com/v1/acct', 'asdf', + delimiter='-') + self.assertRequests([ + ('GET', '/v1/acct?format=json&delimiter=-', '', { + 'accept-encoding': 'gzip', + 'x-auth-token': 'asdf'}), + ]) + class TestHeadAccount(MockHttpTest): |
