use crate::TestServer; use crate::ADMIN; #[tokio::test] async fn logout() -> anyhow::Result<()> { let mut server = TestServer::new().await?; let owner = &server.next_user_name(); server.api.user_login(ADMIN, ADMIN).await?; server.api.admin_user_add(owner, owner).await?; server.api.user_login(owner, owner).await?; let status = server.api.user_logout().await?; assert_eq!(status, 201); assert_eq!(server.api.token, None); Ok(()) } #[tokio::test] async fn no_token() -> anyhow::Result<()> { let mut server = TestServer::new().await?; let status = server.api.user_logout().await.unwrap_err().status; assert_eq!(status, 401); Ok(()) }