Пример #1
0
    def test_can_submit_too_early(self):
        # 1 day ago should be too early for another submission
        sys = System("TEST_HWUUID", date.today() - timedelta(days=1))
        self.db_session.add(sys)
        self.db_session.commit()

        self.assertFalse(_can_submit(sys))
Пример #2
0
    def test_can_submit(self):
        # make last submission 400 days ago
        sys = System("TEST_HWUUID", date.today() - timedelta(days=400))
        self.db_session.add(sys)
        self.db_session.commit()

        self.assertTrue(_can_submit(sys))
Пример #3
0
    def test_can_submit_too_early(self):
        # 1 day ago should be too early for another submission
        sys = System("TEST_HWUUID", date.today() - timedelta(days=1))
        self.db_session.add(sys)
        self.db_session.commit()

        self.assertFalse(_can_submit(sys))
Пример #4
0
    def test_can_submit(self):
        # make last submission 400 days ago
        sys = System("TEST_HWUUID", date.today() - timedelta(days=400))
        self.db_session.add(sys)
        self.db_session.commit()

        self.assertTrue(_can_submit(sys))
Пример #5
0
    def test_can_submit(self):
        system = System.query.first()

        # make a submission 400 days ago
        sub1 = Submission(system.sys_hwuuid, 'POPCORN1',
                          date.today() - timedelta(days=400))
        self.db_session.add(sub1)
        self.db_session.commit()
        self.assertEqual(system.last_submission, sub1)

        self.assertTrue(_can_submit(system))
Пример #6
0
    def test_can_submit_too_early(self):
        system = System.query.first()

        # 1 day ago should be too early for another submission
        sub1 = Submission(system.sys_hwuuid, 'POPCORN 1',
                          date.today() - timedelta(1))
        self.db_session.add(sub1)
        self.db_session.commit()
        self.assertEqual(system.last_submission, sub1)

        self.assertFalse(_can_submit(system))
Пример #7
0
    def test_can_submit_no_last_submission(self):
        system = System.query.first()

        self.assertIsNone(system.last_submission)
        self.assertTrue(_can_submit(system))