Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)