time_recoder_test.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import unittest
  2. from os import path
  3. import time_recoder.time_recoder_config as config_
  4. import re
  5. from time import sleep
  6. from time_recoder.save_recorded_time_in_table import save_recorded_time_in_table, get_current_time_as_timestamp
  7. from time_recoder.time_recoder_config import TEST_CASE
  8. class ConfigTest(unittest.TestCase):
  9. def test_path_folder_exists(self):
  10. folder_string_index = config_.PATH.rfind('\\')
  11. tested_path = config_.PATH[0:folder_string_index]
  12. self.assertTrue(path.isdir(tested_path), msg='The Folder where the Table should be does not exist, check path')
  13. class TimeRecorderIntegrationtest(unittest.TestCase):
  14. def test_time_recorder_without_gui(self):
  15. ConfigTest().test_path_folder_exists()
  16. # Integration Test
  17. start_time = get_current_time_as_timestamp()
  18. sleep(5)
  19. worked_time_in_minutes = (get_current_time_as_timestamp() - start_time) / 60
  20. save_recorded_time_in_table(worked_time_in_minutes, 'default')
  21. class GUITest(unittest.TestCase):
  22. def test_gui_layout_format(self):
  23. raise NotImplementedError
  24. if __name__ == '__main__':
  25. TimeRecorderIntegrationtest().test_time_recorder_without_gui()