def get(self, serviceName=None): parser_dict = LogParser.parseGetParameters() if serviceName is None: serviceName = getDbName() return getLog(serviceName, parser_dict[NUMBER], parser_dict[OFFSET], dateDeserialiser(parser_dict, DATE_FROM), dateDeserialiser(parser_dict, DATE_TO))
def testGetParser(self): with app.test_request_context('/?' + CORRECT_ARGS): args = LogParser.parseGetParameters() self.assertEquals(args[OFFSET], OFFSET_VALUE) self.assertEquals(args[NUMBER], NUMBER_VALUE) loadedDatetime_from = json.loads( args[DATE_FROM], object_hook=dateDeserialiser( args, DATE_FROM)) self.assertEquals(loadedDatetime_from, DATE_FROM_VALUE) loadedDatetime_to = json.loads( args[DATE_TO], object_hook=dateDeserialiser( args, DATE_TO)) self.assertEquals(loadedDatetime_to, DATE_TO_VALUE) with app.test_request_context('/?' + INCORRECT_ARGS): args = LogParser.parseGetParameters() self.assertIsNone(args.get(OFFSET)) self.assertIsNone(args.get(NUMBER)) self.assertIsNone(args.get(loadedDatetime_from)) self.assertIsNone(args.get(loadedDatetime_to))
def get(self, serviceName=None): parser_dict = LogParser.parseGetParameters() if serviceName is None: serviceName = getDbName() return getLog( serviceName, parser_dict[NUMBER], parser_dict[OFFSET], dateDeserialiser( parser_dict, DATE_FROM), dateDeserialiser( parser_dict, DATE_TO))