Add user agent to API calls
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
This commit is contained in:
parent
cb076a57b9
commit
cd267d5121
3 changed files with 30 additions and 0 deletions
|
|
@ -2,10 +2,12 @@ from __future__ import absolute_import
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
||||
import docker
|
||||
import pytest
|
||||
|
||||
import compose
|
||||
from compose.cli import errors
|
||||
from compose.cli.docker_client import docker_client
|
||||
from compose.cli.docker_client import tls_config_from_options
|
||||
|
|
@ -40,6 +42,16 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
assert fake_log.error.call_count == 1
|
||||
assert '123' in fake_log.error.call_args[0][0]
|
||||
|
||||
def test_user_agent(self):
|
||||
client = docker_client(os.environ)
|
||||
expected = "docker-compose/{0} docker-py/{1} {2}/{3}".format(
|
||||
compose.__version__,
|
||||
docker.__version__,
|
||||
platform.system(),
|
||||
platform.release()
|
||||
)
|
||||
self.assertEqual(client.headers['User-Agent'], expected)
|
||||
|
||||
|
||||
class TLSConfigTestCase(unittest.TestCase):
|
||||
ca_cert = 'tests/fixtures/tls/ca.pem'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue