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)
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)
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)