def test_delete_question(self): delete_list = [1, 4] test_get_request(self, "/course/1/question/sub/delete/", delete_list) # check changes are reflected in database q1 = self.db.session.query(models.Question).get(1) q4 = self.db.session.query(models.Question).get(4) self.assertIsNone(q1) self.assertIsNone(q4)
def test_delete_mcq(self): delete_list = [1, 3, 5] test_get_request(self, "/course/1/question/mcq/delete/", delete_list) # check changes are reflected in database q1 = self.db.session.query(models.MCQQuestion).get(1) q3 = self.db.session.query(models.MCQQuestion).get(3) q5 = self.db.session.query(models.MCQQuestion).get(5) self.assertIsNone(q1) self.assertIsNone(q3) self.assertIsNone(q5)
def test_imp_question(self): # Actual set imp get request. imp_dict = dict(imp=[1, 3], notimp=[2]) test_get_request(self, "/course/1/unit/1/question/mcq/imp/", imp_dict) # check changes are reflected in database q1 = self.db.session.query(models.MCQQuestion).get(1) q2 = self.db.session.query(models.MCQQuestion).get(2) q3 = self.db.session.query(models.MCQQuestion).get(3) self.assertEqual(q1.imp, True) self.assertEqual(q2.imp, False) self.assertEqual(q3.imp, True)