def test_get_available_test(self): self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it') testrows = self.td.get_available_tests() self.assertIsNotNone(testrows) self.assertNotEqual(testrows, []) self.assertTrue('test_db' in [i[1] for i in testrows])
def test_get_questions(self): id = self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it') tags = self.td.load_quesqion_tags(id) questions = self.td.get_questions(id, tags) for tag in tags: self.assertIsInstance(questions[tag], TestQuestion)
def test_load_question_tags(self): self.assertEqual( 5, len( self.td.load_quesqion_tags( self.td.load_to_db( create_test_questions(), 'test_db', 'automatically created db, remove it'))))
def setUpClass(cls): um = UserManager() um.create_user('test_user') um.change_password('test_user', '', '12345678') td = TestDatabase() td.load_to_db(create_test_questions(), 'test_db', 'test base, please delete', replace=True) cls.quiz_id = td.get_test_id('test_db')[0] cls.engine = Engine()
def setUpClass(cls): cls.questions = create_test_questions() cls.td = TestDatabase()
def test_delete_test(self): self.assertTrue( self.td.delete_test( self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it')))
def test_get_test_info(self): info = self.td.get_test_info( self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it')) self.assertIsNotNone(info) self.assertIsInstance(info, tuple)
def test_load_from_db(self): questions = self.td.load_from_db( self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it')) for tag in questions.keys(): self.assertIsInstance(questions[tag], TestQuestion)
def test_get_test_id(self): self.assertTrue( self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it') in self.td.get_test_id('test_db'))
def test_load_to_db(self): id = self.td.load_to_db(create_test_questions(), 'test_db', 'automatically created db, remove it') self.assertIsInstance(id, str)