Пример #1
0
class TestDataService(unittest.TestCase):
    def setUp(self):
        self.testdb = str(time.time()) + ".db"
        self.db = DBConnection(db_filename=self.testdb)
        self.dataservice = DataService(self.testdb)

    def test_get_screenshots(self):
        testhelpers.take_and_add_screenshots(self.db)
        data = self.dataservice.screenshots()
        # print data
        jsonobj = json.loads(data)
        self.assertTrue(len(jsonobj) > 0)

    def test_get_processes(self):
        testhelpers.add_process(self.db)
        data = self.dataservice.processes()
        # print data
        jsonobj = json.loads(data)
        self.assertTrue(len(jsonobj) > 0)

    def test_get_process_cats(self):
        testhelpers.add_process_and_type(self.db)
        process_data = self.dataservice.processes()
        process_type_data = self.dataservice.process_categories()
        print process_type_data
        jsonobj = json.loads(process_type_data)
        self.assertTrue(len(jsonobj) > 0)

    def tearDown(self):
        self.db.session.close()
        rm(self.testdb)
Пример #2
0
 def setUp(self):
     self.testdb = str(time.time()) + ".db"
     self.db = DBConnection(db_filename=self.testdb)
     self.dataservice = DataService(self.testdb)