def test_get_registreret_dates_raises_on_invalid_args_combination(self): # Arrange args = { 'registreringstid': '2020-01-01', 'registreretfra': '2006-01-01', 'registrerettil': '2020-01-01', } # Act with self.assertRaises(BadRequestException): oio_rest.get_registreret_dates(args)
def test_get_registreret_dates_defaults(self): # Arrange args = {} expected_from = None expected_to = None # Act actual_from, actual_to = oio_rest.get_registreret_dates(args) # Assert self.assertEqual(expected_from, actual_from) self.assertEqual(expected_to, actual_to)
def test_get_registreret_dates_registreringstid(self): # Arrange args = { 'registreringstid': '2020-01-01', } expected_from = datetime.datetime(2020, 1, 1) expected_to = expected_from + datetime.timedelta(microseconds=1) # Act actual_from, actual_to = oio_rest.get_registreret_dates(args) # Assert self.assertEqual(expected_from, actual_from) self.assertEqual(expected_to, actual_to)
def test_get_registreret_dates_from_to(self): # Arrange args = { 'registreretfra': '2006-01-01', 'registrerettil': '2020-01-01', } expected_from = '2006-01-01' expected_to = '2020-01-01' # Act actual_from, actual_to = oio_rest.get_registreret_dates(args) # Assert self.assertEqual(expected_from, actual_from) self.assertEqual(expected_to, actual_to)