Ejemplo n.º 1
0
 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])
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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'))))
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
0
 def setUpClass(cls):
     cls.questions = create_test_questions()
     cls.td = TestDatabase()
Ejemplo n.º 6
0
 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')))
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 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'))
Ejemplo n.º 10
0
 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)