def test_create_employee(self): employee = EmployeeProvider.create_simple("Some Name", "some_password", "*****@*****.**") self.assertIsNotNone(employee) self.assertEqual(employee.id, 0) self.assertEqual(employee.name, "Some Name") self.assertEqual(employee.password, "some_password") self.assertEqual(employee.email, "*****@*****.**") self.assertEqual(employee.activated, False)
def test_register_employee_without_balance_vacation(self): employee = EmployeeProvider.create_simple("Some Name", "some_password", "*****@*****.**") now_date = datetime.now() employee = EmployeeProvider.register(employee=employee, employment_date=now_date) self.assertIsNotNone(employee) self.assertEqual(employee.registration_date.year, now_date.year) self.assertEqual(employee.registration_date.month, now_date.month) self.assertEqual(employee.registration_date.day, now_date.day) self.assertEqual(employee.employment_date, now_date) self.assertEqual(employee.vacation, 0)
def test_save_employees(self): storage = EmployeesStorage(FakeDb().build()) employee = EmployeeProvider.create_simple("some name", "some password", "*****@*****.**") storage.save(employee) saved_employee = storage.find_by_email("*****@*****.**") self.assertIsNotNone(saved_employee) self.assertEqual(saved_employee.id, employee.id) self.assertEqual(saved_employee.name, employee.name) self.assertEqual(saved_employee.email, employee.email) self.assertEqual(saved_employee.password, employee.password)