예제 #1
0
    def test_fetch_not_necessarily_active(self):
        """
        Fetch all events, they should all be inactive.
        """
        dirname = os.path.join('tests', 'data', 'noaaport', 'nwx',
                               'watch_warn', 'svrlcl')

        # All these events expired long ago.
        events = fetch_events(dirname)
        for event in events:
            self.assertFalse(event.not_expired())

        # Should result in exactly the same result.
        events = fetch_events(dirname, current=True)
        for event in events:
            self.assertFalse(event.not_expired())
예제 #2
0
    def test_still_active(self):
        """
        Verify that not_expired returns True when correct to do so
        """
        fake_utcnow = lambda cls:  dt.datetime(2015, 7, 24, 8, 0, 0)
        FakeDatetime.utcnow = classmethod(fake_utcnow)

        dirname = os.path.join('tests', 'data', 'noaaport', 'nwx',
                               'watch_warn', 'svrlcl')

        events = fetch_events(dirname)
        self.assertTrue(events[-1].not_expired())
        self.assertEqual(len(events), 17)

        events = fetch_events(dirname, current=True)
        self.assertTrue(events[-1].not_expired())
        self.assertEqual(len(events), 1)