def test_get_client_using_provided_host(self):
     cli = client.get_client(self.host)
     cli._do_request = mock.MagicMock()
     cli.configure_from_url = mock.MagicMock()
     cli.auth_plugin.management_url = mock.MagicMock()
     cli.do_request("GET", "/queued_images")
     self.assertFalse(cli.configure_from_url.called)
     self.assertFalse(client.get_client(self.host).configure_via_auth)
 def test_get_client_using_provided_host(self):
     cli = client.get_client(self.host)
     cli._do_request = mock.MagicMock()
     cli.configure_from_url = mock.MagicMock()
     cli.auth_plugin.management_url = mock.MagicMock()
     cli.do_request("GET", "/queued_images")
     self.assertFalse(cli.configure_from_url.called)
     self.assertFalse(client.get_client(self.host).configure_via_auth)
 def test_get_client_host_only(self):
     expected_creds = {
         "username": None,
         "password": None,
         "tenant": None,
         "auth_url": None,
         "strategy": "noauth",
         "region": None,
     }
     self.assertEqual(expected_creds, client.get_client(self.host).creds)
 def test_get_client_host_only(self):
     expected_creds = {
         'username': None,
         'password': None,
         'tenant': None,
         'auth_url': None,
         'strategy': 'noauth',
         'region': None
     }
     self.assertEqual(expected_creds, client.get_client(self.host).creds)
 def test_get_client_host_only(self):
     expected_creds = {
         'username': None,
         'password': None,
         'tenant': None,
         'auth_url': None,
         'strategy': 'noauth',
         'region': None
     }
     self.assertEqual(expected_creds, client.get_client(self.host).creds)
 def test_get_client_all_creds(self):
     expected_creds = {
         'username': '******',
         'password': '******',
         'tenant': 'ten',
         'auth_url': 'url',
         'strategy': 'keystone',
         'region': 'reg'
     }
     creds = client.get_client(self.host,
                               username='******',
                               password='******',
                               tenant='ten',
                               auth_url='url',
                               auth_strategy='strategy',
                               region='reg').creds
     self.assertEqual(expected_creds, creds)
 def test_get_client_all_creds(self):
     expected_creds = {
         "username": "******",
         "password": "******",
         "tenant": "ten",
         "auth_url": "url",
         "strategy": "keystone",
         "region": "reg",
     }
     creds = client.get_client(
         self.host,
         username="******",
         password="******",
         tenant="ten",
         auth_url="url",
         auth_strategy="strategy",
         region="reg",
     ).creds
     self.assertEqual(expected_creds, creds)
 def test_get_client_all_creds(self):
     expected_creds = {
         'username': '******',
         'password': '******',
         'tenant': 'ten',
         'auth_url': 'url',
         'strategy': 'keystone',
         'region': 'reg'
     }
     creds = client.get_client(
         self.host,
         username='******',
         password='******',
         tenant='ten',
         auth_url='url',
         auth_strategy='strategy',
         region='reg'
     ).creds
     self.assertEqual(expected_creds, creds)