def test_new(): customer = Customer() customer = customer.new_from_dict({ "first_name": "John", "last_name": "Doe", "middle_initial": "F" }) assert customer.str() == "Customer [first_name: John, last_name: Doe]"
def test_new_from_dict(): customer = Customer() customer_dict = { "identifier": str(uuid.uuid4()), "first_name": "John", "last_name": "Doe", "middle_initial": "F" } customer = customer.new_from_dict(customer_dict) assert customer.to_dict() == customer_dict
def save(self, customer): _new_customer = Customer.new_from_dict(customer) _saved_customer = self._customer_dao.save(_new_customer) return _saved_customer