def test_list(self): """Simple list should return api call""" self.request.db = MagicMock() self.request.db.distinct.return_value = ["a", "b", "c"] self.request.access.has_permission.side_effect = lambda x, _: x == "b" result = simple(self.request) self.assertEqual(result, {"pkgs": ["b"]})
def test_list(self): """ Simple list should return api call """ self.request.db = MagicMock() self.request.db.distinct.return_value = ["a", "b", "c"] self.request.access.has_permission.side_effect = lambda x, _: x == "b" result = simple(self.request) self.assertEqual(result, {"pkgs": ["b"]})
def test_list(self): """ Simple list should return api call """ self.request.db = MagicMock() self.request.db.distinct.return_value = ['a', 'b', 'c'] self.request.access.has_permission.side_effect = lambda x, _: x == 'b' result = simple(self.request) self.assertEqual(result, {'pkgs': ['b']})