def test_locations(self): self.assertEqual(location('8.8.8.8'), 'United States') self.assertEqual(location('44.55.66.77'), 'San Diego, United States')
def location(self, obj): return location(obj.ip)
def test_no_location(self): self.assertEqual(location('127.0.0.1'), '<i>unknown</i>')
def test_no_location(self): self.assertEqual(location('127.0.0.1'), None)
def test_locations(self): self.assertEqual('United States', location('8.8.8.8')) self.assertIn('United States', location('44.55.66.77'))
def test_locations(self): self.assertEqual(location("8.8.8.8"), "Mountain View, United States") self.assertEqual(location("44.55.66.77"), "San Diego, United States")
def test_no_location(self): self.assertEqual(location("127.0.0.1"), "<i>unknown</i>")