Kaydet (Commit) be0afebc authored tarafından Joffrey F's avatar Joffrey F

Update unit tests to use API v1.12

üst 7722d718
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
CURRENT_VERSION = 'v1.9' CURRENT_VERSION = 'v1.12'
FAKE_CONTAINER_ID = '3cc2351ab11b' FAKE_CONTAINER_ID = '3cc2351ab11b'
FAKE_IMAGE_ID = 'e9aa60c60128' FAKE_IMAGE_ID = 'e9aa60c60128'
...@@ -316,7 +316,7 @@ fake_responses = { ...@@ -316,7 +316,7 @@ fake_responses = {
post_fake_tag_image, post_fake_tag_image,
'{1}/{0}/containers/3cc2351ab11b/wait'.format(CURRENT_VERSION, prefix): '{1}/{0}/containers/3cc2351ab11b/wait'.format(CURRENT_VERSION, prefix):
get_fake_wait, get_fake_wait,
'{1}/{0}/containers/3cc2351ab11b/attach'.format(CURRENT_VERSION, prefix): '{1}/{0}/containers/3cc2351ab11b/logs'.format(CURRENT_VERSION, prefix):
get_fake_logs, get_fake_logs,
'{1}/{0}/containers/3cc2351ab11b/changes'.format(CURRENT_VERSION, prefix): '{1}/{0}/containers/3cc2351ab11b/changes'.format(CURRENT_VERSION, prefix):
get_fake_diff, get_fake_diff,
......
...@@ -339,6 +339,11 @@ class DockerClientTest(unittest.TestCase): ...@@ -339,6 +339,11 @@ class DockerClientTest(unittest.TestCase):
try: try:
self.client.create_container('busybox', 'true', self.client.create_container('busybox', 'true',
volumes_from=vol_names) volumes_from=vol_names)
except docker.errors.DockerException as e:
self.assertTrue(
docker.utils.compare_version('1.10', self.client._version) >= 0
)
return
except Exception as e: except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
args = fake_request.call_args args = fake_request.call_args
...@@ -740,8 +745,8 @@ class DockerClientTest(unittest.TestCase): ...@@ -740,8 +745,8 @@ class DockerClientTest(unittest.TestCase):
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
fake_request.assert_called_with( fake_request.assert_called_with(
url_prefix + 'containers/3cc2351ab11b/attach', url_prefix + 'containers/3cc2351ab11b/logs',
params={'stream': 0, 'logs': 1, 'stderr': 1, 'stdout': 1}, params={'timestamps': 0, 'follow': 0, 'stderr': 1, 'stdout': 1},
timeout=docker.client.DEFAULT_TIMEOUT_SECONDS, timeout=docker.client.DEFAULT_TIMEOUT_SECONDS,
stream=False stream=False
) )
...@@ -758,8 +763,8 @@ class DockerClientTest(unittest.TestCase): ...@@ -758,8 +763,8 @@ class DockerClientTest(unittest.TestCase):
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
fake_request.assert_called_with( fake_request.assert_called_with(
url_prefix + 'containers/3cc2351ab11b/attach', url_prefix + 'containers/3cc2351ab11b/logs',
params={'stream': 0, 'logs': 1, 'stderr': 1, 'stdout': 1}, params={'timestamps': 0, 'follow': 0, 'stderr': 1, 'stdout': 1},
timeout=docker.client.DEFAULT_TIMEOUT_SECONDS, timeout=docker.client.DEFAULT_TIMEOUT_SECONDS,
stream=False stream=False
) )
...@@ -776,8 +781,8 @@ class DockerClientTest(unittest.TestCase): ...@@ -776,8 +781,8 @@ class DockerClientTest(unittest.TestCase):
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
fake_request.assert_called_with( fake_request.assert_called_with(
url_prefix + 'containers/3cc2351ab11b/attach', url_prefix + 'containers/3cc2351ab11b/logs',
params={'stream': 1, 'logs': 1, 'stderr': 1, 'stdout': 1}, params={'timestamps': 0, 'follow': 1, 'stderr': 1, 'stdout': 1},
timeout=docker.client.DEFAULT_TIMEOUT_SECONDS, timeout=docker.client.DEFAULT_TIMEOUT_SECONDS,
stream=True stream=True
) )
...@@ -1133,6 +1138,11 @@ class DockerClientTest(unittest.TestCase): ...@@ -1133,6 +1138,11 @@ class DockerClientTest(unittest.TestCase):
try: try:
self.client.insert(fake_api.FAKE_IMAGE_NAME, self.client.insert(fake_api.FAKE_IMAGE_NAME,
fake_api.FAKE_URL, fake_api.FAKE_PATH) fake_api.FAKE_URL, fake_api.FAKE_PATH)
except docker.errors.DeprecatedMethod as e:
self.assertTrue(
docker.utils.compare_version('1.12', self.client._version) >= 0
)
return
except Exception as e: except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e)) self.fail('Command should not raise exception: {0}'.format(e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment