diff options
author | Joffrey F <joffrey@docker.com> | 2015-08-31 15:01:40 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-08-31 15:01:40 -0700 |
commit | 3d884f9a3c47d12dac7596b790638813580233ac (patch) | |
tree | b72e9b2b4026165c0f5fd0c701556e14eb302b3a | |
parent | 0f3d7673f36f150f38abed71cae3f250c1bee32b (diff) | |
download | docker-py-697-stricter-url-construction.tar.gz |
Test URL construction697-stricter-url-construction
-rw-r--r-- | tests/test.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test.py b/tests/test.py index 1bf8c55..9cf94a1 100644 --- a/tests/test.py +++ b/tests/test.py @@ -144,6 +144,28 @@ class DockerClientTest(Cleanup, base.BaseTestCase): 'Version parameter must be a string or None. Found float' ) + def test_url_valid_resource(self): + url = self.client._url('/hello/{0}/world', 'somename') + self.assertEqual( + url, '{0}{1}'.format(url_prefix, 'hello/somename/world') + ) + + url = self.client._url('/hello/{0}/world', '/some?name') + self.assertEqual( + url, '{0}{1}'.format(url_prefix, 'hello/%2Fsome%3Fname/world') + ) + + def test_url_invalid_resource(self): + with pytest.raises(ValueError): + self.client._url('/hello/{0}/world', ['sakuya', 'izayoi']) + + def test_url_no_resource(self): + url = self.client._url('/simple') + self.assertEqual(url, '{0}{1}'.format(url_prefix, 'simple')) + + url = self.client._url('/simple', None) + self.assertEqual(url, '{0}{1}'.format(url_prefix, 'simple')) + ######################### # INFORMATION TESTS # ######################### |