diff --git a/crates/matrix-sdk/src/authentication/oauth/tests.rs b/crates/matrix-sdk/src/authentication/oauth/tests.rs index b1d2050d8..11f3c2f82 100644 --- a/crates/matrix-sdk/src/authentication/oauth/tests.rs +++ b/crates/matrix-sdk/src/authentication/oauth/tests.rs @@ -174,8 +174,7 @@ async fn test_high_level_login_cancellation() -> anyhow::Result<()> { assert_eq!(oauth.client_id().map(|id| id.as_str()), Some("test_client_id")); - check_authorization_url(&authorization_data, &oauth, &server.server().uri(), None, None, None) - .await; + check_authorization_url(&authorization_data, &oauth, &server.uri(), None, None, None).await; // When completing login with a cancellation callback. redirect_uri.set_query(Some(&format!( @@ -206,8 +205,7 @@ async fn test_high_level_login_invalid_state() -> anyhow::Result<()> { assert_eq!(oauth.client_id().map(|id| id.as_str()), Some("test_client_id")); - check_authorization_url(&authorization_data, &oauth, &server.server().uri(), None, None, None) - .await; + check_authorization_url(&authorization_data, &oauth, &server.uri(), None, None, None).await; // When completing login with an old/tampered state. redirect_uri.set_query(Some("code=42&state=imposter_alert")); @@ -228,7 +226,7 @@ async fn test_high_level_login_invalid_state() -> anyhow::Result<()> { #[async_test] async fn test_login_url() -> anyhow::Result<()> { let server = MatrixMockServer::new().await; - let server_uri = server.server().uri(); + let server_uri = server.uri(); let oauth_server = server.oauth(); oauth_server.mock_server_metadata().ok().expect(3).mount().await; @@ -509,7 +507,7 @@ async fn test_oauth_session() -> anyhow::Result<()> { #[async_test] async fn test_insecure_clients() -> anyhow::Result<()> { let server = MatrixMockServer::new().await; - let server_url = server.server().uri(); + let server_url = server.uri(); server.mock_well_known().ok().expect(1..).named("well_known").mount().await; server.mock_versions().ok().expect(1..).named("versions").mount().await; diff --git a/crates/matrix-sdk/src/test_utils/mocks/mod.rs b/crates/matrix-sdk/src/test_utils/mocks/mod.rs index 9ba9860dc..62a8afae6 100644 --- a/crates/matrix-sdk/src/test_utils/mocks/mod.rs +++ b/crates/matrix-sdk/src/test_utils/mocks/mod.rs @@ -188,6 +188,11 @@ impl MatrixMockServer { &self.server } + /// Return the URI of this server. + pub fn uri(&self) -> String { + self.server.uri() + } + /// Get an `OAuthMockServer` that uses the same mock server as this one. pub fn oauth(&self) -> oauth::OAuthMockServer<'_> { oauth::OAuthMockServer::new(self) diff --git a/crates/matrix-sdk/src/test_utils/mocks/oauth.rs b/crates/matrix-sdk/src/test_utils/mocks/oauth.rs index a43209d14..055b07c8f 100644 --- a/crates/matrix-sdk/src/test_utils/mocks/oauth.rs +++ b/crates/matrix-sdk/src/test_utils/mocks/oauth.rs @@ -69,7 +69,7 @@ impl<'a> OAuthMockServer<'a> { /// Get the mock OAuth 2.0 server metadata. pub fn server_metadata(&self) -> AuthorizationServerMetadata { - MockServerMetadataBuilder::new(&self.server.server().uri()) + MockServerMetadataBuilder::new(&self.server.uri()) .build() .deserialize() .expect("mock OAuth 2.0 server metadata should deserialize successfully") diff --git a/crates/matrix-sdk/tests/integration/encryption/cross_signing.rs b/crates/matrix-sdk/tests/integration/encryption/cross_signing.rs index cf4ca53ea..0f8677c9d 100644 --- a/crates/matrix-sdk/tests/integration/encryption/cross_signing.rs +++ b/crates/matrix-sdk/tests/integration/encryption/cross_signing.rs @@ -153,7 +153,7 @@ async fn test_reset_oauth() { assert_let!(CrossSigningResetAuthType::OAuth(oauth_info) = reset_handle.auth_type()); assert_eq!( oauth_info.approval_url.as_str(), - format!("{}/account/?action=org.matrix.cross_signing_reset", server.server().uri()) + format!("{}/account/?action=org.matrix.cross_signing_reset", server.uri()) ); // Then it retries until it succeeds.