Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)