def test_update_customer(): """ GIVEN CreateCustomerCommand with a valid properties author, title and content WHEN the execute method is called THEN a new Customer must exist in the database with the same attributes """ customer = Customer(first_name="Opemipo", last_name="Durodola", phone_number="08182104309", email="*****@*****.**", address="Row 3 House 6 Staff Qtrs", city="Lagos").create_customer() cmd = UpdateCustomerCommand(id=customer.id, update={ "first_name": "Emmanuel", "last_name": "Caster", "phone_number": "08182104309", "email": "*****@*****.**", "address": "Row 3 House 6 Staff Qtrs", "city": "Lagos" }) cmd.execute() db_customer = Customer.get(customer.id) assert db_customer["first_name"] == cmd.update["first_name"] assert db_customer["last_name"] == cmd.update["last_name"] assert db_customer["phone_number"] == cmd.update["phone_number"] assert db_customer["email"] == cmd.update["email"] assert db_customer["address"] == cmd.update["address"] assert db_customer["city"] == cmd.update["city"]
def execute(self) -> Customer: customer = Customer.get(self.id) return customer
def execute(self) -> List[Customer]: customer = Customer.get() return customer