Example #1
0
 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))
Example #2
0
 def test_region_blank(self):
     """Verify that region can be set to an empty string."""
     obj = Location(name="Name", country="Country", region="")
     obj.save()
Example #3
0
 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)
Example #4
0
 def test_area_blank(self):
     """Verify that area can be set to an empty string."""
     obj = Location(name="Name", country="Country", area="")
     obj.save()
Example #5
0
 def test_default_include(self):
     """Verify that include defaults to True."""
     obj = Location(name="Name", country="Country")
     obj.save()
     self.assertFalse(obj.include)
Example #6
0
 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))
Example #7
0
 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()
Example #8
0
 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)
Example #9
0
 def test_longitude_blank(self):
     """Verify that longitude can be set to an empty string."""
     obj = Location(name="Name", country="Country", lon="")
     obj.save()