Ejemplo n.º 1
0
 def test_update(self):
     test_entity_new = Employee.random()
     test_entity_new.id = random.randint(1, MAX_ENTITY_NUM)
     Operator.update(Employee, marsh(test_entity_new, EmployeeSchema))
     self.assertEqual(
         marsh(test_entity_new, EmployeeSchema),
         marsh(Operator.get_by_id(Employee, test_entity_new.id),
               EmployeeSchema))
Ejemplo n.º 2
0
    def test_update(self):
        test_entity_new = Employee.random()
        test_entity_new_id = random.randint(1, MAX_ENTITY_NUM)
        test_entity_new.id = test_entity_new_id

        self.client.put(f'/employees/{test_entity_new_id}',
                        data=marsh(test_entity_new, EmployeeSchema))

        get_response = self.client.get(f'/employees/{test_entity_new_id}')
        self.assertEqual(marsh(test_entity_new, EmployeeSchema),
                         marsh(get_response.get_json(), EmployeeSchema))
Ejemplo n.º 3
0
    def test_insert(self):
        test_entity = Employee.random()
        post_response = self.client.post('/employees',
                                         data=marsh(test_entity,
                                                    EmployeeSchema))

        test_entity_id = post_response.get_json().get('data')
        test_entity.id = test_entity_id

        get_response = self.client.get(f'/employees/{test_entity.id}')
        self.assertEqual(marsh(test_entity, EmployeeSchema),
                         marsh(get_response.get_json(), EmployeeSchema))
Ejemplo n.º 4
0
 def test_insert(self):
     test_entity = Employee.random()
     test_entity_id = Operator.insert(test_entity)
     self.assertEqual(test_entity,
                      Operator.get_by_id(Employee, test_entity_id))