def test_get_keystone_auth(self): mock_identity = self._init_mock_cfg(True) expected_auth = mock.sentinel.auth actual_auth = auth_utils._get_keystone_auth() self.assertEqual(expected_auth, actual_auth) mock_identity.load_auth_from_conf_options.assert_called_once_with( cfg.CONF, auth_utils.CFG_MURANO_AUTH_GROUP)
def test_get_keystone_with_trust_id(self): mock_ka_loading = self._init_mock_cfg(True) expected_kwargs = { 'project_name': None, 'project_domain_name': None, 'project_id': None, 'trust_id': mock.sentinel.trust_id } expected_auth = mock.sentinel.auth actual_auth = auth_utils._get_keystone_auth(mock.sentinel.trust_id) self.assertEqual(expected_auth, actual_auth) mock_ka_loading.load_auth_from_conf_options.assert_called_once_with( cfg.CONF, auth_utils.CFG_MURANO_AUTH_GROUP, **expected_kwargs)
def test_get_keystone_auth_with_trust_id_fallback_to_v2(self): mock_identity = self._init_mock_cfg(False) expected_kwargs = { 'auth_url': 'foo_auth_uri/v3', 'username': '******', 'password': '******', 'user_domain_name': 'default', 'trust_id': mock.sentinel.trust_id } expected_auth = mock.sentinel.auth actual_auth = auth_utils._get_keystone_auth(mock.sentinel.trust_id) self.assertEqual(expected_auth, actual_auth) mock_identity.Password.assert_called_once_with(**expected_kwargs)
def test_get_keystone_auth(self): mock_cfg, mock_identity = self._init_mock_cfg(False) expected_kwargs = { 'auth_url': 'foo_auth_uri/v3', 'username': mock.sentinel.admin_user, 'password': mock.sentinel.admin_password, 'user_domain_name': mock.sentinel.user_domain_name, 'project_name': mock.sentinel.admin_project_name, 'project_domain_name': mock.sentinel.project_domain_name } expected_auth = mock.sentinel.auth actual_auth = auth_utils._get_keystone_auth() self.assertEqual(expected_auth, actual_auth) mock_identity.Password.assert_called_once_with(**expected_kwargs)