def test_get_client_with_auth_token_saladier_url(self): self.useFixture(fixtures.MonkeyPatch("saladierclient.client._get_ksclient", fake_get_ksclient)) kwargs = {"saladier_url": "http://saladier.example.org:8777/", "os_auth_token": "USER_AUTH_TOKEN"} client = scl.get_client("1", **kwargs) self.assertEqual("USER_AUTH_TOKEN", client.http_client.auth_token) self.assertEqual("http://saladier.example.org:8777/", client.http_client.endpoint)
def test_get_client_with_auth_token_saladier_url(self): self.useFixture(fixtures.MonkeyPatch( 'saladierclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'saladier_url': 'http://saladier.example.org:8777/', 'os_auth_token': 'USER_AUTH_TOKEN', } client = scl.get_client('1', **kwargs) self.assertEqual('USER_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://saladier.example.org:8777/', client.http_client.endpoint)
def test_ensure_auth_ref_propagated(self): ksclient = fake_get_ksclient self.useFixture(fixtures.MonkeyPatch("saladierclient.client._get_ksclient", ksclient)) kwargs = { "os_tenant_name": "TENANT_NAME", "os_username": "******", "os_password": "******", "os_auth_url": "http://localhost:35357/v2.0", "os_auth_token": "", } client = scl.get_client("1", **kwargs) self.assertEqual(ksclient().auth_ref, client.http_client.auth_ref)
def test_get_client_with_auth_token(self): self.useFixture(fixtures.MonkeyPatch("saladierclient.client._get_ksclient", fake_get_ksclient)) kwargs = { "os_tenant_name": "TENANT_NAME", "os_username": "******", "os_password": "******", "os_auth_url": "http://localhost:35357/v2.0", "os_auth_token": "USER_AUTH_TOKEN", } client = scl.get_client("1", **kwargs) self.assertEqual("USER_AUTH_TOKEN", client.http_client.auth_token) self.assertEqual("http://localhost:6385/v1/f14b41234", client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref)
def test_ensure_auth_ref_propagated(self): ksclient = fake_get_ksclient self.useFixture(fixtures.MonkeyPatch( 'saladierclient.client._get_ksclient', ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': '******', 'os_password': '******', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = scl.get_client('1', **kwargs) self.assertEqual(ksclient().auth_ref, client.http_client.auth_ref)
def test_get_client_with_auth_token(self): self.useFixture(fixtures.MonkeyPatch( 'saladierclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': '******', 'os_password': '******', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': 'USER_AUTH_TOKEN', } client = scl.get_client('1', **kwargs) self.assertEqual('USER_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://localhost:6385/v1/f14b41234', client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref)