示例#1
0
    def setUp(self):
        super(UserTrustManagerTestCase, self).setUp()

        self._user_id = '123'
        self._project_id = '456'
        self._ctx = context.RequestContext(user_id=self._user_id,
                                           project_id=self._project_id)
        self._manager = user_trust_manager.UserTrustManager()
        self._manager._skp = FakeSKP()
示例#2
0
    def _create_karbor_client(cls, user_id, project_id):
        token = user_trust_manager.UserTrustManager().get_token(
            user_id, project_id)
        if not token:
            return None
        ctx = context.get_admin_context()
        ctx.auth_token = token
        ctx.project_id = project_id

        karbor_url = cls.KARBOR_ENDPOINT.replace("$(tenant_id)s", project_id)
        return karbor_client.create(ctx, endpoint=karbor_url)
示例#3
0
    def setUp(self):
        super(UserTrustManagerTestCase, self).setUp()

        self._user_id = '123'
        self._project_id = '456'
        self._ctx = context.RequestContext(user_id=self._user_id,
                                           project_id=self._project_id)

        with mock.patch.object(karbor_keystone_plugin.KarborKeystonePlugin,
                               '_do_init'):
            self._manager = user_trust_manager.UserTrustManager()
            self._manager._skp = FakeSKP()
示例#4
0
 def user_trust_manager(self):
     if not self._user_trust_manager:
         self._user_trust_manager = user_trust_manager.UserTrustManager()
     return self._user_trust_manager
示例#5
0
 def init_host(self, **kwargs):
     self._trigger_manager = trigger_manager.TriggerManager()
     self._service_id = kwargs.get("service_id")
     self._user_trust_manager = user_trust_manager.UserTrustManager()
     self._restore()
示例#6
0
    def test_singleton_user_trust_manager(self, do_init):
        map_id = id(self._manager._user_trust_map)
        new_manager = user_trust_manager.UserTrustManager()

        self.assertEqual(id(self._manager), id(new_manager))
        self.assertEqual(map_id, id(new_manager._user_trust_map))