def test_workorder_must_match_pattern(self): ventouris_processor = VentourisProcessor() with self.assertRaises(Exception): ventouris_processor.process_workorder('An invalid workorder')
def test_workorder_gets_trimmed(self): ventouris_processor = VentourisProcessor() self.assertEqual(ventouris_processor.process_workorder('PZ--001.001 - Algemeen'), 'PZ--001.001') self.assertEqual(ventouris_processor.process_workorder('PZ--999.999. Gemeenschapelijk'), 'PZ--999.999') self.assertEqual(ventouris_processor.process_workorder('PZ--102.102'), 'PZ--102.102')
def test_activity_left_untouched(self): ventouris_processor = VentourisProcessor() self.assertEqual(ventouris_processor.process_activity('AP'), 'AP') self.assertEqual(ventouris_processor.process_activity(''), '')
def test_description_with_usd_gets_trimmed(self): ventouris_processor = VentourisProcessor() self.assertEqual(ventouris_processor.process_description('USD5595745 - some work'), 'USD5595745') self.assertEqual(ventouris_processor.process_description('USD5595745. Work'), 'USD5595745') self.assertEqual(ventouris_processor.process_description('USD5595745'), 'USD5595745')
def test_description_with_svf8776_untouched(self): ventouris_processor = VentourisProcessor() untouchable_descr = 'SVF-8776. Fonds' self.assertEqual(ventouris_processor.process_description(untouchable_descr), untouchable_descr)
def test_description_with_svf_gets_trimmed(self): ventouris_processor = VentourisProcessor() self.assertEqual(ventouris_processor.process_description('SVF-1234 - Something'), 'SVF-1234') self.assertEqual(ventouris_processor.process_description('SVF-1234. Work'), 'SVF-1234') self.assertEqual(ventouris_processor.process_description('SVF-12345'), 'SVF-12345')
from datetime import date, datetime import util import locale from data_providers import toggl from model.spent_time_records import WorkedDay from model.ventouris_processor import VentourisProcessor from page_objects.camis.timesheet import Timesheet target_date = date.today() #target_date = datetime.strptime('2021-01-07 17:00:00', '%Y-%m-%d %H:%M:%S') print('=' * 50) print(f'The date is {target_date}') day_report = WorkedDay(toggl.load_time_entries(target_date), caption_processor=VentourisProcessor()) day_report.normalize_hours() print(f'∑ Total registered hours: {day_report.total_hours()}\n') ts = Timesheet(util.should_go_headless(day_report, target_date)) util.fill_camis(day_report, ts, target_date) ts.save() print('=' * 50) print('Done! Check if everything is ok and then Save') input('Press any key to exit...') ts.close() quit(0)