コード例 #1
0
    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'!")
コード例 #2
0
 def test_problem_does_not_exist_problem_id(self):
     self.assertFalse(DjangoGateway.problem_exists(problem_id=99999999))
コード例 #3
0
 def test_problem_does_not_exist_via_name(self):
     self.assertFalse(DjangoGateway.problem_exists(name='not there'))
コード例 #4
0
    def test_problem_exists_via_problem_id(self):
        problem_id = OrmProblem.objects.last().pk

        self.assertTrue(DjangoGateway.problem_exists(problem_id=problem_id))
コード例 #5
0
 def test_problem_exists_via_name(self):
     self.assertTrue(DjangoGateway.problem_exists(name='name1'))