def test_monkey_patch_representation(self): """Verify changing the representation returned by __unicode__.""" function = lambda self: "%s %s" % (self.name, self.region) with mock.patch.object(Location, "__unicode__", function): obj = Location(name="Name", region="Region", country="Country") obj.save() self.assertEqual("Name Region", unicode(obj))
def test_region_blank(self): """Verify that region can be set to an empty string.""" obj = Location(name="Name", country="Country", region="") obj.save()
def test_default_region(self): """Verify that region defaults to an empty string.""" obj = Location(name="Name", country="Country") obj.save() self.assertEqual("", obj.region)
def test_area_blank(self): """Verify that area can be set to an empty string.""" obj = Location(name="Name", country="Country", area="") obj.save()
def test_default_include(self): """Verify that include defaults to True.""" obj = Location(name="Name", country="Country") obj.save() self.assertFalse(obj.include)
def test_representation(self): """Verify the object can be displayed in the admin.""" obj = Location(name="Name", country="Country") obj.save() self.assertTrue(unicode(obj))
def test_grid_reference_blank(self): """Verify that gridref can be set to an empty string.""" obj = Location(name="Name", country="Country", gridref="") obj.save()
def test_default_grid_refernece(self): """Verify that gridref defaults to an empty string.""" obj = Location(name="Name", country="Country") obj.save() self.assertEqual("", obj.gridref)
def test_longitude_blank(self): """Verify that longitude can be set to an empty string.""" obj = Location(name="Name", country="Country", lon="") obj.save()