コード例 #1
0
    def test_get_virkning_dates_raises_on_invalid_args_combination(self):
        # Arrange
        args = {
            'virkningstid': '2020-01-01',
            'virkningfra': '2006-01-01',
            'virkningtil': '2020-01-01',
        }

        # Act
        with self.assertRaises(BadRequestException):
            oio_rest.get_virkning_dates(args)
コード例 #2
0
    def test_get_virkning_dates_defaults(self):
        # Arrange
        args = {}

        expected_from = datetime.datetime(2017, 1, 1, 1)
        expected_to = expected_from + datetime.timedelta(microseconds=1)

        # Act
        actual_from, actual_to = oio_rest.get_virkning_dates(args)

        # Assert
        self.assertEqual(expected_from, actual_from)
        self.assertEqual(expected_to, actual_to)
コード例 #3
0
    def test_get_virkning_dates_virkningstid(self):
        # Arrange
        args = {
            'virkningstid': '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_virkning_dates(args)

        # Assert
        self.assertEqual(expected_from, actual_from)
        self.assertEqual(expected_to, actual_to)
コード例 #4
0
    def test_get_virkning_dates_from_to(self):
        # Arrange
        args = {
            'virkningfra': '2006-01-01',
            'virkningtil': '2020-01-01',
        }

        expected_from = '2006-01-01'
        expected_to = '2020-01-01'

        # Act
        actual_from, actual_to = oio_rest.get_virkning_dates(args)

        # Assert
        self.assertEqual(expected_from, actual_from)
        self.assertEqual(expected_to, actual_to)