Esempio n. 1
0
    def test_delete_entry(self):
        entries = Entry.select()
        index = 0

        with mock.patch('builtins.input', side_effect=["y", ""]):
            worklog.delete_task(index, entries)
            self.assertEqual(Entry.select().count(), 1)
Esempio n. 2
0
 def test_search_by_date_range(self):
     expected = 1
     entries = Entry.select()
     with unittest.mock.patch('builtins.input',
                              side_effect=["24-08-1991", "24-08-1997"]):
         actual = worklog.search_by_date_range(entries)
         self.assertEqual(len(actual), expected)
Esempio n. 3
0
 def test_search_by_employee(self):
     expected = 1
     entries = Entry.select()
     with unittest.mock.patch('builtins.input',
                              side_effect=["Ben Employee test"]):
         actual = worklog.search_by_employee(entries)
         self.assertEqual(actual.select().count(), expected)
Esempio n. 4
0
 def test_view_all_tasks(self):
     expected = 2
     entries = Entry.select()
     with unittest.mock.patch('builtins.input', side_effect=[""]):
         actual = worklog.view_all_tasks(entries)
         self.assertEqual(len(actual), expected)
Esempio n. 5
0
 def test_search_by_duration(self):
     expected = 1
     entries = Entry.select()
     with unittest.mock.patch('builtins.input', side_effect=["20"]):
         actual = worklog.search_by_time_spent(entries)
         self.assertEqual(len(actual), expected)