def test_timestamp_arbitrary_parse(self):
     tz = pytz.timezone('Africa/Nairobi')
     timezone.activate(tz)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(field.to_internal_value(timestamp.isoformat()).tzinfo, aware_datetime().tzinfo)
     timezone.deactivate()
Example #2
0
 def test_timestamp_utc_parse(self):
     timezone.activate(pytz.utc)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(
         field.to_internal_value(timestamp.isoformat()).tzinfo,
         aware_datetime().tzinfo)
     timezone.deactivate()
Example #3
0
 def test_timestamp_arbitrary_parse(self):
     tz = pytz.timezone('Africa/Nairobi')
     timezone.activate(tz)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(
         field.to_internal_value(timestamp.isoformat()).tzinfo,
         aware_datetime().tzinfo)
     timezone.deactivate()
 def test_timestamp_utc_parse(self):
     timezone.activate(pytz.utc)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(field.to_internal_value(timestamp.isoformat()).tzinfo, aware_datetime().tzinfo)
     timezone.deactivate()