diff options
author | Zuul <zuul@review.opendev.org> | 2023-05-16 22:35:22 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-05-16 22:35:22 +0000 |
commit | e5bf28e7862cf85eaa27075f109ff0004583855e (patch) | |
tree | 376e2ad42e65a394af294c255f54786541dc295e /nova/tests/unit/network/test_neutron.py | |
parent | f9c8e96d1cb5c442b5bf1e88243b20df095842e8 (diff) | |
parent | 6cc4e7fb9ac49606c598e72fcd3d6cf02efac4f1 (diff) | |
download | nova-e5bf28e7862cf85eaa27075f109ff0004583855e.tar.gz |
Merge "Enable use of service user token with admin context" into stable/xenastable/xena
Diffstat (limited to 'nova/tests/unit/network/test_neutron.py')
-rw-r--r-- | nova/tests/unit/network/test_neutron.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/tests/unit/network/test_neutron.py b/nova/tests/unit/network/test_neutron.py index 879f8a9ed6..e5e39adf65 100644 --- a/nova/tests/unit/network/test_neutron.py +++ b/nova/tests/unit/network/test_neutron.py @@ -143,6 +143,22 @@ class TestNeutronClient(test.NoDBTestCase): self.assertIsInstance(cl.httpclient.auth, service_token.ServiceTokenAuthWrapper) + @mock.patch('nova.service_auth._SERVICE_AUTH') + @mock.patch('nova.network.neutron._ADMIN_AUTH') + @mock.patch.object(ks_loading, 'load_auth_from_conf_options') + def test_admin_with_service_token( + self, mock_load, mock_admin_auth, mock_service_auth + ): + self.flags(send_service_user_token=True, group='service_user') + + admin_context = context.get_admin_context() + + cl = neutronapi.get_client(admin_context) + self.assertIsInstance(cl.httpclient.auth, + service_token.ServiceTokenAuthWrapper) + self.assertEqual(mock_admin_auth, cl.httpclient.auth.user_auth) + self.assertEqual(mock_service_auth, cl.httpclient.auth.service_auth) + @mock.patch.object(client.Client, "list_networks", side_effect=exceptions.Unauthorized()) def test_Unauthorized_user(self, mock_list_networks): |