Skip to content

Commit

Permalink
Test SMTP settings
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo committed Jan 24, 2018
1 parent d316d80 commit 61e8e14
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def test_dotd(self):
("realpath", "auto/addons/product"),
("bash", "-c", 'test "$(realpath auto/addons/product)" == '
'/opt/odoo/custom/src/dummy_repo/product'),
# SMTP settings work
("bash", "-c",
"createdb && ./custom/scripts/test_smtp_settings.py"),
# ``odoo`` command works
("odoo", "--version"),
# Implicit ``odoo`` command also works
Expand Down
17 changes: 17 additions & 0 deletions tests/scaffoldings/dotd/custom/scripts/test_smtp_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/local/bin/python-odoo-shell
from odoo.exceptions import UserError
from odoo.tools import config

assert config.get("email_from") == "[email protected]"
assert config.get("smtp_password") is False
assert config.get("smtp_port") == 1025
assert config.get("smtp_server") == "mailhog"
assert config.get("smtp_ssl") is False
assert config.get("smtp_user") is False

try:
env["ir.mail_server"].test_smtp_connection()
except UserError as msg:
assert "Connection Test Succeeded!" in msg.args[0]
else:
raise Exception("This shouldn't happen :/")
6 changes: 6 additions & 0 deletions tests/scaffoldings/dotd/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ services:
LOG_LEVEL: DEBUG
tty: true
environment:
EMAIL_FROM: [email protected]
PGUSER: another_odoo
PGPASSWORD: anotherodoopassword
PGHOST: postgresql
PGDATABASE: ${DBNAME:-prod}
SMTP_SERVER: mailhog
SMTP_PORT: 1025 # MailHog default
depends_on:
- postgresql
volumes:
Expand All @@ -27,6 +30,9 @@ services:
volumes:
- db:/var/lib/postgresql/data:z

mailhog:
image: mailhog/mailhog

volumes:
db:
filestore:

0 comments on commit 61e8e14

Please sign in to comment.