def test_problem_in_oj(self): ''' test for problem with oj is good :return: None ''' oj = OJList(name='test') db.session.add(oj) db.session.commit() problem = Problem() problem.oj_id = oj.id db.session.add(problem) db.session.commit() self.assertTrue(problem.oj.name == 'test')
def test_problem_after_delete_oj(self): ''' test for ping func is good :return: None ''' oj = OJList(name='test') db.session.add(oj) db.session.commit() problem = Problem() problem.oj_id = oj.id db.session.add(problem) db.session.commit() db.session.delete(oj) db.session.commit() self.assertTrue(Problem.query.count() == 0)