forked from eventmachine/eventmachine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,52 +30,54 @@ | |
|
||
class TestSmtpClient < Test::Unit::TestCase | ||
|
||
Localhost = "127.0.0.1" | ||
Localport = 9801 | ||
Localhost = "127.0.0.1" | ||
Localport = 9801 | ||
|
||
def setup | ||
end | ||
def setup | ||
end | ||
|
||
def teardown | ||
end | ||
def teardown | ||
end | ||
|
||
def test_a | ||
# No real tests until we have a server implementation to test against. | ||
# This is what the call looks like, though: | ||
def test_a | ||
# No real tests until we have a server implementation to test against. | ||
# This is what the call looks like, though: | ||
err = nil | ||
EM.run { | ||
d = EM::Protocols::SmtpClient.send :domain=>"example.com", | ||
:host=>Localhost, | ||
:port=>Localport, # optional, defaults 25 | ||
:starttls=>true, | ||
:from=>"[email protected]", | ||
:to=> ["[email protected]", "[email protected]"], | ||
:header=> {"Subject" => "This is a subject line"}, | ||
:body=> "This is the body of the email", | ||
:verbose=>true | ||
d.errback {|e| | ||
err = e | ||
EM.stop | ||
} | ||
} | ||
assert(err) | ||
end | ||
|
||
EM.run { | ||
d = EM::Protocols::SmtpClient.send :domain=>"example.com", | ||
:host=>Localhost, | ||
:port=>Localport, # optional, defaults 25 | ||
:starttls=>true, | ||
:from=>"[email protected]", | ||
:to=> ["[email protected]", "[email protected]"], | ||
:header=> {"Subject" => "This is a subject line"}, | ||
:body=> "This is the body of the email", | ||
:verbose=>true | ||
d.errback {|e| | ||
p e | ||
EM.stop | ||
} | ||
} | ||
end | ||
|
||
def test_content | ||
|
||
EM.run { | ||
d = EM::Protocols::SmtpClient.send :domain=>"example.com", | ||
:host=>Localhost, | ||
:port=>Localport, # optional, defaults 25 | ||
:starttls=>true, | ||
:from=>"[email protected]", | ||
:to=> ["[email protected]", "[email protected]"], | ||
:content => ["Subject: xxx\r\n\r\ndata\r\n.\r\n"], | ||
:verbose=>true | ||
d.errback {|e| | ||
p e | ||
EM.stop | ||
} | ||
} | ||
end | ||
def test_content | ||
err = nil | ||
EM.run { | ||
d = EM::Protocols::SmtpClient.send :domain=>"example.com", | ||
:host=>Localhost, | ||
:port=>Localport, # optional, defaults 25 | ||
:starttls=>true, | ||
:from=>"[email protected]", | ||
:to=> ["[email protected]", "[email protected]"], | ||
:content => ["Subject: xxx\r\n\r\ndata\r\n.\r\n"], | ||
:verbose=>true | ||
d.errback {|e| | ||
err = e | ||
EM.stop | ||
} | ||
} | ||
assert(err) | ||
end | ||
|
||
end |