From d9bdb207ccd8cb469927e35d3da9244efefca23b Mon Sep 17 00:00:00 2001 From: Mikhail Date: Fri, 12 Apr 2024 23:02:13 +0200 Subject: [PATCH] Rollback tests --- crates/projection-xmpp/tests/lib.rs | 74 ----------------------------- 1 file changed, 74 deletions(-) diff --git a/crates/projection-xmpp/tests/lib.rs b/crates/projection-xmpp/tests/lib.rs index cc51ea5..9dfae4c 100644 --- a/crates/projection-xmpp/tests/lib.rs +++ b/crates/projection-xmpp/tests/lib.rs @@ -108,7 +108,6 @@ impl<'a> TestScopeTls<'a> { } struct IgnoreCertVerification; - impl ServerCertVerifier for IgnoreCertVerification { fn verify_server_cert( &self, @@ -123,79 +122,6 @@ impl ServerCertVerifier for IgnoreCertVerification { } } -/// Some clients prefer to close their tags, i.e. Gajim. -#[tokio::test] -async fn scenario_basic_closed_tag() -> Result<()> { - tracing_subscriber::fmt::try_init(); - let config = ServerConfig { - listen_on: "127.0.0.1:0".parse().unwrap(), - cert: "tests/certs/xmpp.pem".parse().unwrap(), - key: "tests/certs/xmpp.key".parse().unwrap(), - }; - let mut metrics = MetricsRegistry::new(); - let mut storage = Storage::open(StorageConfig { - db_path: ":memory:".into(), - }) - .await?; - let rooms = RoomRegistry::new(&mut metrics, storage.clone()).unwrap(); - let players = PlayerRegistry::empty(rooms.clone(), &mut metrics).unwrap(); - let server = launch(config, players, rooms, metrics, storage.clone()).await.unwrap(); - - // test scenario - - storage.create_user("tester").await?; - storage.set_password("tester", "password").await?; - - let mut stream = TcpStream::connect(server.addr).await?; - let mut s = TestScope::new(&mut stream); - tracing::info!("TCP connection established"); - - s.send(r#""#).await?; - s.send(r#" - - "#).await?; - - assert_matches!(s.next_xml_event().await?, Event::Decl(_) => {}); - assert_matches!(s.next_xml_event().await?, Event::Start(b) => assert_eq!(b.local_name().into_inner(), b"stream")); - assert_matches!(s.next_xml_event().await?, Event::Start(b) => assert_eq!(b.local_name().into_inner(), b"features")); - assert_matches!(s.next_xml_event().await?, Event::Start(b) => assert_eq!(b.local_name().into_inner(), b"starttls")); - assert_matches!(s.next_xml_event().await?, Event::Empty(b) => assert_eq!(b.local_name().into_inner(), b"required")); - assert_matches!(s.next_xml_event().await?, Event::End(b) => assert_eq!(b.local_name().into_inner(), b"starttls")); - assert_matches!(s.next_xml_event().await?, Event::End(b) => assert_eq!(b.local_name().into_inner(), b"features")); - s.send(r#""#).await?; - assert_matches!(s.next_xml_event().await?, Event::Empty(b) => assert_eq!(b.local_name().into_inner(), b"proceed")); - let buffer = s.buffer; - tracing::info!("TLS feature negotiation complete"); - - let connector = TlsConnector::from(Arc::new( - ClientConfig::builder() - .with_safe_defaults() - .with_custom_certificate_verifier(Arc::new(IgnoreCertVerification)) - .with_no_client_auth(), - )); - tracing::info!("Initiating TLS connection..."); - let mut stream = connector.connect(ServerName::IpAddress(server.addr.ip()), stream).await?; - tracing::info!("TLS connection established"); - - let mut s = TestScopeTls::new(&mut stream, buffer); - - s.send(r#""#).await?; - s.send(r#" - - - - "#).await?; - assert_matches!(s.next_xml_event().await?, Event::Decl(_) => {}); - assert_matches!(s.next_xml_event().await?, Event::Start(b) => assert_eq!(b.local_name().into_inner(), b"stream")); - - stream.shutdown().await?; - - // wrap up - - server.terminate().await?; - Ok(()) -} - #[tokio::test] async fn scenario_basic() -> Result<()> { tracing_subscriber::fmt::try_init();