Exemple #1
0
 def test_all_ok(self):
     div = OrganisationDivisionFactory()
     div.official_identifier = "gss:X01000001"
     div.save()
     dg = DivisionGeographyFactory(division=div)
     dg.source = "this is totally fine"
     dg.save()
     self.assertEqual(len(DivisionProblem.objects.all()), 0)
Exemple #2
0
 def test_no_geography(self):
     div = OrganisationDivisionFactory()
     div.official_identifier = "gss:X01000001"
     div.save()
     self.assertEqual(len(DivisionProblem.objects.all()), 1)
     problem = DivisionProblem.objects.all()[0]
     self.assertFalse(problem.no_gss_code)
     self.assertTrue(problem.no_geography)
     self.assertTrue(problem.invalid_source)
     self.assertEqual("No associated DivisionGeography",
                      problem.problem_text)
Exemple #3
0
 def test_all_broken(self):
     div = OrganisationDivisionFactory()
     div.save()
     dg = DivisionGeographyFactory(division=div)
     dg.source = ""
     dg.save()
     self.assertEqual(len(DivisionProblem.objects.all()), 1)
     problem = DivisionProblem.objects.all()[0]
     self.assertTrue(problem.no_gss_code)
     self.assertTrue(problem.invalid_source)
     self.assertTrue(problem.invalid_source)
     self.assertEqual("No GSS code", problem.problem_text)
Exemple #4
0
 def test_invalid_source(self):
     div = OrganisationDivisionFactory()
     div.official_identifier = "gss:X01000001"
     div.save()
     dg = DivisionGeographyFactory(division=div)
     dg.source = "unknown"
     dg.save()
     self.assertEqual(len(DivisionProblem.objects.all()), 1)
     problem = DivisionProblem.objects.all()[0]
     self.assertFalse(problem.no_gss_code)
     self.assertFalse(problem.no_geography)
     self.assertTrue(problem.invalid_source)
     self.assertEqual("Boundary source is invalid", problem.problem_text)