def get_task_stub_repo(self, context, authorization_layer=True): repo = glance.db.TaskRepo(context, self.db_api) if authorization_layer: repo = policy.TaskStubRepoProxy(repo, context, self.policy) repo = glance.notifier.TaskStubRepoProxy(repo, context, self.notifier) if authorization_layer: repo = authorization.TaskStubRepoProxy(repo, context) return repo
def get_task_stub_repo(self, context): task_stub_repo = glance.db.TaskRepo(context, self.db_api) policy_task_stub_repo = policy.TaskStubRepoProxy( task_stub_repo, context, self.policy) notifier_task_stub_repo = glance.notifier.TaskStubRepoProxy( policy_task_stub_repo, context, self.notifier) authorized_task_stub_repo = authorization.TaskStubRepoProxy( notifier_task_stub_repo, context) return authorized_task_stub_repo
def setUp(self): super(TestTaskRepoProxy, self).setUp() task_factory = glance.domain.TaskFactory() task_type = 'import' owner = None self.fixtures = [ task_factory.new_task(task_type, owner), task_factory.new_task(task_type, owner), task_factory.new_task(task_type, owner), ] self.context = glance.context.RequestContext(tenant=TENANT1) task_repo = self.TaskRepoStub(self.fixtures) task_stub_repo = self.TaskStubRepoStub(self.fixtures) self.task_repo = authorization.TaskRepoProxy(task_repo, self.context) self.task_stub_repo = authorization.TaskStubRepoProxy( task_stub_repo, self.context)