def test_userlogs_get_all(self, UserlogHandler, resp_mock, request_mock): hand_get = UserlogHandler.return_value.get_all_by_id fake_userlog = fakes.FakeUserlog() resource_uuid = fake_userlog.resource_uuid hand_get.return_value = [fake_userlog] resp = userlog.UserlogsController(resource_uuid).get_all() self.assertEqual(fake_userlog.resource_uuid, resp['result'][0].resource_uuid) self.assertEqual(fake_userlog.resource_type, resp['result'][0].resource_type) self.assertEqual(fake_userlog.location, resp['result'][0].location) self.assertEqual(fake_userlog.strategy, resp['result'][0].strategy) self.assertEqual(fake_userlog.strategy_info, resp['result'][0].strategy_info) hand_get.assert_called_with(resource_uuid) self.assertEqual(200, resp_mock.status) self.assertIsNotNone(resp)
def _lookup(self, primary_key, *remainder): if remainder and not remainder[-1]: remainder = remainder[:-1] if primary_key == 'logs': logs = userlog_controller.UserlogsController(self._id) return logs, remainder