def test_string_representation(self): place = Place() place.save() self.assertEqual(unicode(place), 'No named place object') placeName = PlaceName(content='능이향기') placeName.save() place.placeName = placeName place.save() self.assertEqual(unicode(place), '능이향기')
def test_placeName_column(self): place = Place() test_data = '능이향기' placeName = PlaceName(content=test_data) placeName.save() place.placeName = placeName place.save() saved = Place.objects.first() self.assertEqual(place.placeName, placeName) self.assertEqual(place.placeName.content, test_data) self.assertEqual(saved, place) self.assertEqual(saved.placeName, placeName) self.assertEqual(saved.placeName.content, test_data) self.assertEqual(placeName.places.first(), saved) self.assertEqual( Place.objects.filter(placeName=placeName).first(), saved)