mirror of https://github.com/docker/docker-py.git
Add unit tests
Signed-off-by: Keerthan Reddy Mala <kmala@deis.com>
This commit is contained in:
parent
9b63bed6a0
commit
1294d3c410
|
@ -2,6 +2,7 @@ import docker
|
|||
import pytest
|
||||
|
||||
from . import fake_api
|
||||
from docker import auth
|
||||
from .api_test import (
|
||||
DockerClientTest, fake_request, DEFAULT_TIMEOUT_SECONDS, url_prefix,
|
||||
fake_resolve_authconfig
|
||||
|
@ -262,6 +263,31 @@ class ImageTest(DockerClientTest):
|
|||
timeout=DEFAULT_TIMEOUT_SECONDS
|
||||
)
|
||||
|
||||
def test_push_image_with_auth(self):
|
||||
auth_config = {
|
||||
'username': "test_user",
|
||||
'password': "test_password",
|
||||
'serveraddress': "test_server",
|
||||
}
|
||||
encoded_auth = auth.encode_header(auth_config)
|
||||
self.client.push(
|
||||
fake_api.FAKE_IMAGE_NAME, tag=fake_api.FAKE_TAG_NAME,
|
||||
auth_config=auth_config
|
||||
)
|
||||
|
||||
fake_request.assert_called_with(
|
||||
'POST',
|
||||
url_prefix + 'images/test_image/push',
|
||||
params={
|
||||
'tag': fake_api.FAKE_TAG_NAME,
|
||||
},
|
||||
data='{}',
|
||||
headers={'Content-Type': 'application/json',
|
||||
'X-Registry-Auth': encoded_auth},
|
||||
stream=False,
|
||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
||||
)
|
||||
|
||||
def test_push_image_stream(self):
|
||||
with mock.patch('docker.auth.auth.resolve_authconfig',
|
||||
fake_resolve_authconfig):
|
||||
|
|
Loading…
Reference in New Issue