Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed May 20, 2024
1 parent c97789c commit 0e53ebe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 36 deletions.
26 changes: 8 additions & 18 deletions suppaftp/src/async_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,15 +1153,10 @@ mod test {
.await
.unwrap();
assert!(stream.login("test", "test").await.is_ok());
assert_eq!(
stream.get_welcome_msg().unwrap(),
r#"220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 3 of 5 allowed.
220-Local time is now 08:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity."#
);
assert!(stream
.get_welcome_msg()
.unwrap()
.contains("220 You will be disconnected after 15 minutes of inactivity."));
}

#[async_attributes::test]
Expand All @@ -1170,15 +1165,10 @@ mod test {
async fn welcome_message() {
crate::log_init();
let stream = setup_stream().await;
assert_eq!(
stream.get_welcome_msg().unwrap(),
r#"220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 3 of 5 allowed.
220-Local time is now 08:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity."#
);
assert!(stream
.get_welcome_msg()
.unwrap()
.contains("220 You will be disconnected after 15 minutes of inactivity."));
finalize_stream(stream).await;
}

Expand Down
26 changes: 8 additions & 18 deletions suppaftp/src/sync_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,15 +1135,10 @@ mod test {
let addr: SocketAddr = "127.0.0.1:10021".parse().expect("invalid hostname");
let mut stream = FtpStream::connect_timeout(addr, Duration::from_secs(15)).unwrap();
assert!(stream.login("test", "test").is_ok());
assert_eq!(
stream.get_welcome_msg().unwrap(),
r#"220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 3 of 5 allowed.
220-Local time is now 08:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity."#
);
assert!(stream
.get_welcome_msg()
.unwrap()
.contains("220 You will be disconnected after 15 minutes of inactivity."));
}

#[test]
Expand All @@ -1152,15 +1147,10 @@ mod test {
fn welcome_message() {
crate::log_init();
let stream: FtpStream = setup_stream();
assert_eq!(
stream.get_welcome_msg().unwrap(),
r#"220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 3 of 5 allowed.
220-Local time is now 08:30. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity."#
);
assert!(stream
.get_welcome_msg()
.unwrap()
.contains("220 You will be disconnected after 15 minutes of inactivity."));
finalize_stream(stream);
}

Expand Down

0 comments on commit 0e53ebe

Please sign in to comment.