Exemplo n.º 1
0
    def test_new_event_simple(self):
        from swingtime.forms import EventForm, MultipleOccurrenceForm

        data = dict(
            title='QWERTY',
            event_type='1',
            day='2008-12-11',
            start_time_delta='28800',
            end_time_delta='29700',
            year_month_ordinal_day='2',
            month_ordinal_day='2',
            holidays='skip',
            year_month_ordinal='1',
            month_option='each',
            repeats='count',
            freq='2',
            occurences='2',
            month_ordinal='1',
            request={'user': '******'},
        )

        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        self.assertTrue(evt_form.is_valid(), evt_form.errors.as_text())
        self.assertTrue(occ_form.is_valid(), occ_form.errors.as_text())

        self.assertEqual(occ_form.cleaned_data['start_time'],
                         datetime(2008, 12, 11, 8),
                         'Bad start_time: %s' % pformat(occ_form.cleaned_data))
Exemplo n.º 2
0
    def test_new_event_simple(self):
        data = dict(title='QWERTY',
                    event_type='1',
                    day='2008-12-11',
                    start_time_delta='28800',
                    end_time_delta='29700',
                    year_month_ordinal_day='2',
                    month_ordinal_day='2',
                    year_month_ordinal='1',
                    month_option='each',
                    count=2,
                    repeats='count',
                    freq='2',
                    month_ordinal='1')

        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        self.assertTrue(evt_form.is_valid(), evt_form.errors.as_text())
        self.assertTrue(occ_form.is_valid(), occ_form.errors.as_text())

        evt = occ_form.save(evt_form.save())
        self.assertEqual(evt.occurrence_set.count(), 2)

        self.assertEqual(
            occ_form.cleaned_data['start_time'], datetime(2008, 12, 11, 8),
            'Bad start_time: {0}'.format(pformat(occ_form.cleaned_data)))
Exemplo n.º 3
0
    def test_new_event_simple(self, play_type):
        data = dict(
            title='QWERTY',
            event_type=play_type.id,
            day='2008-12-11',
            start_time_delta='28800',
            end_time_delta='29700',
            year_month_ordinal_day='2',
            month_ordinal_day='2',
            year_month_ordinal='1',
            month_option='each',
            count=2,
            repeats='count',
            freq='2',
            month_ordinal='1'
        )
        
        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        assert True == evt_form.is_valid()
        assert '' == evt_form.errors.as_text()
        assert True == occ_form.is_valid()
        assert '' == occ_form.errors.as_text()

        evt = occ_form.save(evt_form.save())
        assert evt.occurrence_set.count() == 2
        assert occ_form.cleaned_data['start_time'] == datetime(2008, 12, 11, 8)
Exemplo n.º 4
0
    def test_new_event_simple(self):
        data = dict(
            title='QWERTY',
            event_type='1',
            day='2008-12-11',
            start_time_delta='28800',
            end_time_delta='29700',
            year_month_ordinal_day='2',
            month_ordinal_day='2',
            year_month_ordinal='1',
            month_option='each',
            count=2,
            repeats='count',
            freq='2',
            month_ordinal='1'
        )
        
        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        self.assertTrue(evt_form.is_valid(), evt_form.errors.as_text())
        self.assertTrue(occ_form.is_valid(), occ_form.errors.as_text())

        evt = occ_form.save(evt_form.save())
        self.assertEqual(evt.occurrence_set.count(), 2)
        
        self.assertEqual(
            occ_form.cleaned_data['start_time'],
            datetime(2008, 12, 11, 8),
            'Bad start_time: {0}'.format(pformat(occ_form.cleaned_data))
        )
Exemplo n.º 5
0
    def test_new_event_simple(self):
        from swingtime.forms import EventForm, MultipleOccurrenceForm

        data = dict(
            title='QWERTY',
            event_type='1',
            day='2008-12-11',
            start_time_delta='28800',
            end_time_delta='29700',
            year_month_ordinal_day='2',
            month_ordinal_day='2',
            holidays='skip',
            year_month_ordinal='1',
            month_option='each',
            repeats='count',
            freq='2',
            occurences='2',
            month_ordinal='1',
            request={'user': '******'},
        )

        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        self.assertTrue(evt_form.is_valid(), evt_form.errors.as_text())
        self.assertTrue(occ_form.is_valid(), occ_form.errors.as_text())

        self.assertEqual(
            occ_form.cleaned_data['start_time'],
            datetime(2008, 12, 11, 8),
            'Bad start_time: %s' % pformat(occ_form.cleaned_data)
        )
Exemplo n.º 6
0
    def test_new_event_simple(self, play_type):
        data = dict(
            title='QWERTY',
            event_type=play_type.id,
            day='2008-12-11',
            start_time_delta='28800',
            end_time_delta='29700',
            year_month_ordinal_day='2',
            month_ordinal_day='2',
            year_month_ordinal='1',
            month_option='each',
            count=2,
            repeats='count',
            freq='2',
            month_ordinal='1'
        )
        
        evt_form = EventForm(data)
        occ_form = MultipleOccurrenceForm(data)
        assert True == evt_form.is_valid()
        assert '' == evt_form.errors.as_text()
        assert True == occ_form.is_valid()
        assert '' == occ_form.errors.as_text()

        evt = occ_form.save(evt_form.save())
        assert evt.occurrence_set.count() == 2
        assert occ_form.cleaned_data['start_time'] == datetime(2008, 12, 11, 8)