Maintenance: Fix email tests by avoiding an unreliable external host.
This commit is contained in:
parent
db0229e629
commit
e5d9fb37dd
1 changed files with 12 additions and 12 deletions
|
@ -144,7 +144,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
result = EmailHelper::Probe.inbound(
|
result = EmailHelper::Probe.inbound(
|
||||||
adapter: 'imap2',
|
adapter: 'imap2',
|
||||||
options: {
|
options: {
|
||||||
host: 'not_existsing_host',
|
host: 'nonexisting_host',
|
||||||
port: 993,
|
port: 993,
|
||||||
ssl: true,
|
ssl: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
|
@ -158,7 +158,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
result = EmailHelper::Probe.inbound(
|
result = EmailHelper::Probe.inbound(
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
options: {
|
options: {
|
||||||
host: 'not_existsing_host',
|
host: 'nonexisting_host',
|
||||||
port: 993,
|
port: 993,
|
||||||
ssl: true,
|
ssl: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
|
@ -168,14 +168,14 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_equal('invalid', result[:result])
|
assert_equal('invalid', result[:result])
|
||||||
assert_equal('Hostname not found!', result[:message_human])
|
assert_equal('Hostname not found!', result[:message_human])
|
||||||
assert_equal('not_existsing_host', result[:settings][:options][:host])
|
assert_equal('nonexisting_host', result[:settings][:options][:host])
|
||||||
|
|
||||||
# try to access imap on host with blocked port to force a "Connection refused!" error
|
# try to access imap on host with blocked port to force a "Connection refused!" error
|
||||||
result = EmailHelper::Probe.inbound(
|
result = EmailHelper::Probe.inbound(
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
options: {
|
options: {
|
||||||
host: 'no-imap-host.test.zammad.org',
|
host: '127.0.0.1',
|
||||||
port: 993,
|
port: 8, # no service to be expected
|
||||||
ssl: true,
|
ssl: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
password: 'password',
|
password: 'password',
|
||||||
|
@ -183,7 +183,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert_equal('invalid', result[:result])
|
assert_equal('invalid', result[:result])
|
||||||
assert_equal('Connection refused!', result[:message_human])
|
assert_equal('Connection refused!', result[:message_human])
|
||||||
assert_equal('no-imap-host.test.zammad.org', result[:settings][:options][:host])
|
assert_equal('127.0.0.1', result[:settings][:options][:host])
|
||||||
|
|
||||||
result = EmailHelper::Probe.inbound(
|
result = EmailHelper::Probe.inbound(
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
|
@ -277,7 +277,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
adapter: 'smtp2',
|
adapter: 'smtp2',
|
||||||
options: {
|
options: {
|
||||||
host: 'not_existsing_host',
|
host: 'nonexisting_host',
|
||||||
port: 25,
|
port: 25,
|
||||||
start_tls: true,
|
start_tls: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
|
@ -294,7 +294,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
adapter: 'smtp',
|
adapter: 'smtp',
|
||||||
options: {
|
options: {
|
||||||
host: 'not_existsing_host',
|
host: 'nonexisting_host',
|
||||||
port: 25,
|
port: 25,
|
||||||
start_tls: true,
|
start_tls: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
|
@ -306,15 +306,15 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_equal('invalid', result[:result])
|
assert_equal('invalid', result[:result])
|
||||||
assert_equal('Hostname not found!', result[:message_human])
|
assert_equal('Hostname not found!', result[:message_human])
|
||||||
assert_equal('not_existsing_host', result[:settings][:options][:host])
|
assert_equal('nonexisting_host', result[:settings][:options][:host])
|
||||||
|
|
||||||
# try to access SMTP on host with blocked port to force a "Connection refused!" error
|
# try to access SMTP on host with blocked port to force a "Connection refused!" error
|
||||||
result = EmailHelper::Probe.outbound(
|
result = EmailHelper::Probe.outbound(
|
||||||
{
|
{
|
||||||
adapter: 'smtp',
|
adapter: 'smtp',
|
||||||
options: {
|
options: {
|
||||||
host: 'no-imap-host.test.zammad.org',
|
host: '127.0.0.1',
|
||||||
port: 26,
|
port: 8, # no service to be expected
|
||||||
start_tls: true,
|
start_tls: true,
|
||||||
user: 'some@example.com',
|
user: 'some@example.com',
|
||||||
password: 'password',
|
password: 'password',
|
||||||
|
@ -324,7 +324,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
assert_equal('invalid', result[:result])
|
assert_equal('invalid', result[:result])
|
||||||
assert_equal('Connection refused!', result[:message_human])
|
assert_equal('Connection refused!', result[:message_human])
|
||||||
assert_equal('no-imap-host.test.zammad.org', result[:settings][:options][:host])
|
assert_equal('127.0.0.1', result[:settings][:options][:host])
|
||||||
|
|
||||||
result = EmailHelper::Probe.outbound(
|
result = EmailHelper::Probe.outbound(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue