Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_net/tests/smtp.rs

2.1 KiB, 30 runs

created by r1870400018:619, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1use oxedyne_fe2o3_net::{
2 //conc::AsyncReadIterator,
3 //email::msg::{
4 // EmailHeader,
5 // EmailMessage,
6 //},
7 smtp::{
8 cmd::SmtpCommand,
9 //msg::SmtpMessageReader,
10 },
11};
12
13use oxedyne_fe2o3_core::{
14 prelude::*,
15 test::test_it,
16};
17//use oxedyne_fe2o3_text::string::Stringer;
18//
19//use std::{
20// pin::Pin,
21//};
22
23
24pub fn test_smtp(filter: &'static str) -> Outcome<()> {
25
26// S: 220 serverb.example.com ESMTP ExampleMTA
27// C: EHLO servera.example.org
28// S: 250-serverb.example.com
29// S: 250-PIPELINING
30// S: 250-SIZE 10240000
31// S: 250-VRFY
32// S: 250-ETRN
33// S: 250-STARTTLS
34// S: 250-ENHANCEDSTATUSCODES
35// S: 250-8BITMIME
36// S: 250 DSN
37// C: MAIL FROM:<sender@example.org>
38// S: 250 2.1.0 Ok
39// C: RCPT TO:<recipient@example.com>
40// S: 250 2.1.5 Ok
41// C: DATA
42// S: 354 End data with <CR><LF>.<CR><LF>
43// C: Received: from servera.example.org (servera.example.org [192.168.0.1])
44// C: by serverb.example.com (ExampleMTA) with ESMTP id 12345678
45// C: for <recipient@example.com>; Fri, 11 Jun 2023 09:30:00 -0500 (EST)
46// C: From: Sender <sender@example.org>
47// C: To: Recipient <recipient@example.com>
48// C: Subject: Test message
49// C: Date: Fri, 11 Jun 2023 09:30:00 -0500
50// C: Message-ID: <12345.67890@servera.example.org>
51// C:
52// C: This is a test message sent from Server A to Server B.
53// C:
54// C: Best regards,
55// C: Sender
56// C: .
57// S: 250 2.0.0 Ok: queued as ABCDEF123456
58// C: QUIT
59// S: 221 2.0.0 Bye
60
61 res!(test_it(filter, &["Smtp commands 000", "all", "smtp"], || {
62 let test = [
63 ("HELO client.example.com", SmtpCommand::Helo(fmt!("client.example.com"))),
64 ("EHLO client.example.com", SmtpCommand::Ehlo(fmt!("client.example.com"))),
65 ("MAIL FROM:<sender@example.com>", SmtpCommand::MailFrom(fmt!("sender@example.com"))),
66 ("RCPT TO:<sender@example.com>", SmtpCommand::RcptTo(fmt!("sender@example.com"))),
67 ];
68 for (wire, expected) in test {
69 let cmd = res!(SmtpCommand::from_str(wire));
70 req!(expected, cmd, "(L: expected, R: actual)");
71 }
72 Ok(())
73 }));
74
75 Ok(())
76}