def test_problem_exists_raises_when_all_inputs(self): with self.assertRaises(ValueError) as context: DjangoGateway.problem_exists(name='test', problem_id=1) self.assertEqual(str(context.exception), "Supply exactly one of 'problem_id' or 'name'!")
def test_problem_does_not_exist_problem_id(self): self.assertFalse(DjangoGateway.problem_exists(problem_id=99999999))
def test_problem_does_not_exist_via_name(self): self.assertFalse(DjangoGateway.problem_exists(name='not there'))
def test_problem_exists_via_problem_id(self): problem_id = OrmProblem.objects.last().pk self.assertTrue(DjangoGateway.problem_exists(problem_id=problem_id))
def test_problem_exists_via_name(self): self.assertTrue(DjangoGateway.problem_exists(name='name1'))