     }
     
     func testUserLoginAndOut() throws {
-        
         let request = Request(method: .get, path: "login")
         
         droplet.get("login") { req in
+            
             try req.auth.login(Identifier(id:1)) // id of first item inserted
             return try req.auth.user().converted(to: JSON.self)
         }

    }

}

extension User: Auth.User {
    

        XCTAssertEqual(res.data["name"]?.string, "John")
        XCTAssertNotNil(res.cookies["vapor-auth"])
        
        try testUserLogout(with: res) //try to logout with content of response (w/ cookies etc.)
        
    }
    
    func testUserLogout(with response:Response) throws {
        let request = Request(method: .get, path: "logout")
        request.cookies = response.cookies
        
        droplet.get("logout") { req in
            
            guard let user = try req.auth.user() as? User, user.id == 1 else {
                throw User.Error.userNotLoggedIn
            }
            
            try req.auth.logout()
            
            return JSON(["message": "User logged out"])
        }
        
