def test_get_conn_override_defaults(self, docker_client_mock):
     hook = DockerHook(docker_conn_id='docker_default',
                       base_url='https://index.docker.io/v1/',
                       version='1.23',
                       tls='someconfig')
     hook.get_conn()
     docker_client_mock.assert_called_with(
         base_url='https://index.docker.io/v1/',
         version='1.23',
         tls='someconfig')
 def test_get_conn_override_defaults(self, docker_client_mock):
     hook = DockerHook(
         docker_conn_id='docker_default',
         base_url='https://index.docker.io/v1/',
         version='1.23',
         tls='someconfig'
     )
     hook.get_conn()
     docker_client_mock.assert_called_with(
         base_url='https://index.docker.io/v1/',
         version='1.23',
         tls='someconfig'
     )
 def test_get_conn_with_extra_config(self, _):
     try:
         hook = DockerHook(docker_conn_id='docker_with_extras',
                           base_url='unix://var/run/docker.sock',
                           version='auto')
         client = hook.get_conn()
         self.assertIsNotNone(client)
     except Exception:
         self.fail('Could not get connection from Airflow')
 def test_conn_with_standard_config_passes_parameters(self, _):
     hook = DockerHook(docker_conn_id='docker_default',
                       base_url='unix://var/run/docker.sock',
                       version='auto')
     client = hook.get_conn()
     client.login.assert_called_with(username='******',
                                     password='******',
                                     registry='some.docker.registry.com',
                                     reauth=True,
                                     email=None)
 def test_conn_with_extra_config_passes_parameters(self, _):
     hook = DockerHook(docker_conn_id='docker_with_extras',
                       base_url='unix://var/run/docker.sock',
                       version='auto')
     client = hook.get_conn()
     client.login.assert_called_with(username='******',
                                     password='******',
                                     registry='some.docker.registry.com',
                                     reauth=False,
                                     email='*****@*****.**')
 def test_get_conn_with_standard_config(self, _):
     try:
         hook = DockerHook(
             docker_conn_id='docker_default',
             base_url='unix://var/run/docker.sock',
             version='auto'
         )
         client = hook.get_conn()
         self.assertIsNotNone(client)
     except:
         self.fail('Could not get connection from Airflow')
 def test_get_conn_with_standard_config(self, _):
     try:
         hook = DockerHook(
             docker_conn_id='docker_default',
             base_url='unix://var/run/docker.sock',
             version='auto'
         )
         client = hook.get_conn()
         self.assertIsNotNone(client)
     except Exception:  # pylint: disable=broad-except
         self.fail('Could not get connection from Airflow')
 def test_conn_with_extra_config_passes_parameters(self, _):
     hook = DockerHook(
         docker_conn_id='docker_with_extras',
         base_url='unix://var/run/docker.sock',
         version='auto'
     )
     client = hook.get_conn()
     client.login.assert_called_with(
         username='******',
         password='******',
         registry='some.docker.registry.com',
         reauth=False,
         email='*****@*****.**'
     )
 def test_conn_with_standard_config_passes_parameters(self, _):
     hook = DockerHook(
         docker_conn_id='docker_default',
         base_url='unix://var/run/docker.sock',
         version='auto'
     )
     client = hook.get_conn()
     client.login.assert_called_with(
         username='******',
         password='******',
         registry='some.docker.registry.com',
         reauth=True,
         email=None
     )