示例#1
0
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]"
示例#2
0
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
示例#3
0
    def save(self, customer):
        _new_customer = Customer.new_from_dict(customer)
        _saved_customer = self._customer_dao.save(_new_customer)

        return _saved_customer