Ejemplo n.º 1
0
class ProcessLoop():
    def __init__(self, db):
        self.db = DBConnection()
        self.ac = ActivityChecker()
    def run(self):
        if (self.ac.checkActive()):
            current_process = processes.get_current()
            added_process = self.db.add_process(current_process)
        else:
            self.db.set_current_process_inactive()
        pass
Ejemplo n.º 2
0
class TestActivityCheckerMouse(unittest.TestCase):
    def setUp(self):
        self.ac = ActivityChecker()

    def test_activity_checker_creation(self):
        time.sleep(0.5)
        self.assertTrue(self.ac.active)

    def test_no_activity(self):
        self.ac.timeout = 1
        print "Don't move the mouse"
        time.sleep(2)
        self.assertFalse(self.ac.checkActive())

    def test_activity(self):
        self.ac.timeout = 1
        print "Move the mouse"
        time.sleep(2)
        self.assertTrue(self.ac.checkActive())

    def tearDown(self):
        self.ac.stop()
        time.sleep(0.5)
Ejemplo n.º 3
0
 def __init__(self, db):
     self.db = DBConnection()
     self.ac = ActivityChecker()
Ejemplo n.º 4
0
 def setUp(self):
     self.ac = ActivityChecker()