def test_window_matches_default_window(self):
        """
        Assert that the window matches the default window
        """
        # Create allocation with no start_date and no end_date
        allocation = create_allocation(self.increase_date)
        end_date = datetime(1990, 1, 1, tzinfo=pytz.utc)

        # Override the default end date to a testable value
        (start, end) = engine.get_allocation_window(
            allocation, default_end_date=end_date)

        self.assertEquals(start, engine._get_zero_date_utc())
        self.assertEquals(end, end_date)
Esempio n. 2
0
    def test_window_matches_default_window(self):
        """
        Assert that the window matches the default window
        """
        # Create allocation with no start_date and no end_date
        allocation = create_allocation(self.increase_date)
        end_date = datetime(1990, 1, 1, tzinfo=pytz.utc)

        # Override the default end date to a testable value
        (start, end) = engine.get_allocation_window(allocation,
                                                    default_end_date=end_date)

        self.assertEquals(start, engine._get_zero_date_utc())
        self.assertEquals(end, end_date)
    def test_get_zero_date_time_is_valid(self):
        """
        Assert that the date time is utc timezone
        """
        zero_datetime = engine._get_zero_date_utc()

        # Validate that the time corresponds to the desired result
        self.assertEqual(zero_datetime.tzinfo, pytz.UTC)
        self.assertEqual(zero_datetime.year, 1970)
        self.assertEqual(zero_datetime.month, 1)
        self.assertEqual(zero_datetime.day, 1)
        self.assertEqual(zero_datetime.hour, 0)
        self.assertEqual(zero_datetime.minute, 0)
        self.assertEqual(zero_datetime.second, 0)
Esempio n. 4
0
    def test_get_zero_date_time_is_valid(self):
        """
        Assert that the date time is utc timezone
        """
        zero_datetime = engine._get_zero_date_utc()

        # Validate that the time corresponds to the desired result
        self.assertEqual(zero_datetime.tzinfo, pytz.UTC)
        self.assertEqual(zero_datetime.year, 1970)
        self.assertEqual(zero_datetime.month, 1)
        self.assertEqual(zero_datetime.day, 1)
        self.assertEqual(zero_datetime.hour, 0)
        self.assertEqual(zero_datetime.minute, 0)
        self.assertEqual(zero_datetime.second, 0)