def test_get_national_holidays(self, login, auth_user_id, absences): absence = Absence(2019, 8) national_holidays = absence.get_national_holidays() assert len(national_holidays ) == 1, 'National holidays should only have one day' assert national_holidays[0] == date(2019, 8, 19)
def test_workday(self): year = 2021 month = 2 day = 3 absence = Absence(year=year, month=month, day=day) assert absence.workday == datetime(year=year, month=month, day=day).date()
def test_get_holidays(self, login, auth_user_id, absences): absence = Absence(2019, 8) holidays = absence.get_holidays() for i, day in enumerate(range(10, 31)): assert holidays[i] == date(2019, 8, day)
def test_get_user_id(self, login, auth_user_id, user_id, absences): absence = Absence(2019, 5) assert absence.user_id == user_id, 'User id is not correct'
def test_create_register(self, login, auth_user_id, timespans_create, absences, month, expected): absence = Absence(2019, month) start = datetime(2019, month, 19) end = datetime(2019, month, 19, 1) assert absence.create_register(start, end) == expected
def test_get_token(self, login, auth_user_id, token, absences): absence = Absence(2019, 2) assert absence.token == token, 'Token is not correct'
def test_is_reduced_workday(self, register_date, expected): absence = Absence(year=register_date.year, month=register_date.month, day=register_date.day) assert absence.is_reduced_workday is expected
def test_is_summertime(self, month, expected): absence = Absence(year=2021, month=month, day=1) assert absence.is_summertime == expected
def test_is_friday(self, day, expected): absence = Absence(year=2021, month=2, day=day) assert absence.is_friday == expected