Add tests for middleware
Fix bug in middleware that occurs when a user does not have a customer