Exemple #1
0
 def test_serialize_unaccepted_employee(self):
     employee = fixtures.load_instance("unaccepted_user", Employee)
     serialized_employee = EmployeeProvider.serialize(employee)
     self.assertIsNotNone(serialized_employee)
     self.assertEqual(serialized_employee['id'], 1)
     self.assertEqual(serialized_employee['name'], 'Unregistered User')
     self.assertEqual(serialized_employee['email'], '*****@*****.**')
     self.assertIsNone(serialized_employee['employment_date'])
     self.assertIsNone(serialized_employee['vacation'])
     self.assertFalse(serialized_employee['activated'])
     self.assertFalse(serialized_employee['is_admin'])
Exemple #2
0
 def test_serialize_employee(self):
     employee = fixtures.load_instance("unactivated_user", Employee)
     employee.employment_date = datetime(2019, 1, 1)
     employee.acceptance_date = datetime(2019, 1, 1)
     serialized_employee = EmployeeProvider.serialize(employee)
     self.assertIsNotNone(serialized_employee)
     self.assertEqual(serialized_employee['id'], 2)
     self.assertEqual(serialized_employee['name'], 'Unactivated User')
     self.assertEqual(serialized_employee['email'], '*****@*****.**')
     self.assertEqual("2019.01.01", serialized_employee['employment_date'])
     self.assertEqual("2019.01.01", serialized_employee['acceptance_date'])
     self.assertEqual(serialized_employee['vacation'], 1.0)
     self.assertEqual(serialized_employee['activated'], False)
     self.assertEqual(serialized_employee['is_admin'], False)