Пример #1
0
    def test_get_current_sequence_number(self):
        cs = sequence_model.get_current_sequence()
        csn = sequence_model.get_current_sequence_number()
        self.assertIsNone(cs)
        self.assertIsNone(csn)

        # test sequence in the past
        now = datetime.datetime.utcnow().date()
        start_date = now - datetime.timedelta(weeks=16)
        signup_close_date = now - datetime.timedelta(weeks=17)
        sequence_model.create_sequence(
            start_date, signup_close_date
        )

        cs = sequence_model.get_current_sequence()
        csn = sequence_model.get_current_sequence_number()
        self.assertIsNone(cs)
        self.assertIsNone(csn)

        start_date = now + datetime.timedelta(weeks=16)
        signup_close_date = now + datetime.timedelta(weeks=17)
        sequence_model.create_sequence(
            start_date, signup_close_date
        )

        cs = sequence_model.get_current_sequence()
        csn = sequence_model.get_current_sequence_number()
        self.assertEqual(cs['id'], csn)
Пример #2
0
    def test_get_current_sequence(self):
        current_sequence = sequence_model.get_current_sequence()

        self.assertEquals(current_sequence, None)

        now = datetime.datetime.utcnow().date()
        start_date = now + datetime.timedelta(weeks=8)
        signup_close_date = now + datetime.timedelta(weeks=7)

        sequence = sequence_model.create_sequence(
            start_date, signup_close_date
        )
        current_sequence = sequence_model.get_current_sequence()

        self.assertEqual(sequence, current_sequence)
Пример #3
0
    def test_multiple_sequences(self):
        now = datetime.datetime.utcnow().date()

        start_date = now - datetime.timedelta(days=1)
        signup_close_date = now - datetime.timedelta(days=1)
        sequence_model.create_sequence(
            start_date, signup_close_date
        )

        start_date = now
        signup_close_date = now
        sequence = sequence_model.create_sequence(
            start_date, signup_close_date
        )

        start_date = now + datetime.timedelta(days=1)
        signup_close_date = now + datetime.timedelta(days=1)
        sequence_model.create_sequence(
            start_date, signup_close_date
        )

        current_sequence = sequence_model.get_current_sequence()
        self.assertEqual(sequence, current_sequence)