Kaydet (Commit) 68b10fa1 authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Ensured that explicit time zones are rejected by forms.

Refs #19371.
üst ec2b91f4
...@@ -1011,6 +1011,11 @@ class NewFormsTests(TestCase): ...@@ -1011,6 +1011,11 @@ class NewFormsTests(TestCase):
self.assertTrue(form.is_valid()) self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data['dt'], datetime.datetime(2011, 9, 1, 10, 20, 30, tzinfo=UTC)) self.assertEqual(form.cleaned_data['dt'], datetime.datetime(2011, 9, 1, 10, 20, 30, tzinfo=UTC))
def test_form_with_explicit_timezone(self):
form = EventForm({'dt': '2011-09-01 17:20:30+07:00'})
# Datetime inputs formats don't allow providing a time zone.
self.assertFalse(form.is_valid())
@skipIf(pytz is None, "this test requires pytz") @skipIf(pytz is None, "this test requires pytz")
def test_form_with_non_existent_time(self): def test_form_with_non_existent_time(self):
with timezone.override(pytz.timezone('Europe/Paris')): with timezone.override(pytz.timezone('Europe/Paris')):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment