def test_serializer_fails_if_no_integer_is_assigned(self): data = {"name": VALENCIA, "location": Point(0, 0), "date": "FAIL"} location_serializer = LocationListSerializer(data=data) self.assertFalse(location_serializer.is_valid())
def test_serializer_fails_if_no_integer_is_assigned(self): data = {'name': VALENCIA, 'location': Point(0, 0), 'date': 'FAIL'} location_serializer = LocationListSerializer(data=data) self.assertFalse(location_serializer.is_valid())
def test_serializer_receive_timestamp_and_stores_datetime_into_database(self): data = {"name": VALENCIA, "location": Point(0, 0), "date_time": self.my_date_in_timestamp} location_serializer = LocationListSerializer(data=data) self.assertTrue(location_serializer.is_valid()) location_serializer.save() location = Location.objects.get(id=location_serializer.data["id"]) self.assertEqual(self.my_date, location.date_time)
def test_serializer_receive_timestamp_and_stores_date_into_database(self): data = { 'name': VALENCIA, 'location': Point(0, 0), 'date': self.my_date_in_timestamp } location_serializer = LocationListSerializer(data=data) self.assertTrue(location_serializer.is_valid()) location_serializer.save() location = Location.objects.get(id=location_serializer.data['id']) self.assertEqual(self.my_date, location.date)