def testBindExceptionTZ25(self): cancellation = CancellationPage(owner = self.user, overrides = self.event, except_date = dt.date(2019,1,21)) Form = get_form_for_model(CancellationPage, form_class=CancellationPageForm) form = Form(instance=cancellation, parent_page=self.event) panel = ExceptionDatePanel('except_date', classname='full-width') panel = panel.bind_to(instance=cancellation) panel = panel.bind_to(request=self._getRequest()) panel = panel.bind_to(form=form) self.assertEqual(panel.exceptionTZ, "Asia/Tokyo")
def testBindWithoutOverrides25(self): cancellation = CancellationPage(owner = self.user, except_date = dt.date(2019,1,21)) Form = get_form_for_model(CancellationPage, form_class=CancellationPageForm) form = Form(instance=cancellation, parent_page=self.event) panel = ExceptionDatePanel('except_date', classname='full-width') panel = panel.bind_to(instance=cancellation) panel = panel.bind_to(request=self._getRequest()) panel = panel.bind_to(form=form) self.assertIsNotNone(panel.form) self.assertIsNone(panel.instance.overrides)
def testBindOverridesRepeat25(self): cancellation = CancellationPage(owner = self.user, overrides = self.event, except_date = dt.date(2019,1,21)) Form = get_form_for_model(CancellationPage, form_class=CancellationPageForm) form = Form(instance=cancellation, parent_page=self.event) widget = form['except_date'].field.widget panel = ExceptionDatePanel('except_date', classname='full-width') panel = panel.bind_to(instance=cancellation) panel = panel.bind_to(request=self._getRequest()) panel = panel.bind_to(form=form) self.assertIs(widget.overrides_repeat, self.event.repeat) self.assertIsNone(panel.exceptionTZ)
def testBindWithoutForm25(self): cancellation = CancellationPage(owner=self.user, except_date=dt.date(2019, 1, 21)) panel = ExceptionDatePanel('except_date', classname='full-width') panel = panel.bind_to(instance=cancellation) self.assertIsNone(panel.form)