Exemplo n.º 1
0
 def test_get_all_not_admin(self):
     ctx = context.RequestContext('fakeuid', 'fakepid', id_admin=False)
     self.mox.StubOutWithMock(share_api.policy, 'check_policy')
     share_api.policy.check_policy(ctx, 'share', 'get_all')
     self.mox.StubOutWithMock(db_driver, 'share_get_all_by_project')
     db_driver.share_get_all_by_project(ctx, 'fakepid')
     self.mox.ReplayAll()
     self.api.get_all(ctx)
Exemplo n.º 2
0
 def test_get_all_not_admin(self):
     ctx = context.RequestContext("fakeuid", "fakepid", id_admin=False)
     self.mox.StubOutWithMock(share_api.policy, "check_policy")
     share_api.policy.check_policy(ctx, "share", "get_all")
     self.mox.StubOutWithMock(db_driver, "share_get_all_by_project")
     db_driver.share_get_all_by_project(ctx, "fakepid")
     self.mox.ReplayAll()
     self.api.get_all(ctx)
Exemplo n.º 3
0
 def test_get_all_not_admin_search_opts(self):
     search_opts = {"size": "fakesize"}
     fake_objs = [{"name": "fakename1"}, search_opts]
     ctx = context.RequestContext("fakeuid", "fakepid", id_admin=False)
     self.mox.StubOutWithMock(share_api.policy, "check_policy")
     share_api.policy.check_policy(ctx, "share", "get_all")
     self.mox.StubOutWithMock(db_driver, "share_get_all_by_project")
     db_driver.share_get_all_by_project(ctx, "fakepid").AndReturn(fake_objs)
     self.mox.ReplayAll()
     result = self.api.get_all(ctx, search_opts)
     self.assertEqual([search_opts], result)
Exemplo n.º 4
0
 def test_get_all_not_admin_search_opts(self):
     search_opts = {'size': 'fakesize'}
     fake_objs = [{'name': 'fakename1'}, search_opts]
     ctx = context.RequestContext('fakeuid', 'fakepid', id_admin=False)
     self.mox.StubOutWithMock(share_api.policy, 'check_policy')
     share_api.policy.check_policy(ctx, 'share', 'get_all')
     self.mox.StubOutWithMock(db_driver, 'share_get_all_by_project')
     db_driver.share_get_all_by_project(ctx,
                                        'fakepid').AndReturn(fake_objs)
     self.mox.ReplayAll()
     result = self.api.get_all(ctx, search_opts)
     self.assertEqual([search_opts], result)