diff --git a/MANIFEST.in b/MANIFEST.in index a5df87347..924be58e3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include README.rst CONTRIBUTING.rst LICENSE requirements.txt +include modoboa/admin/tests/dovecot recursive-include modoboa *.html *.js *.css *.png *.po *.mo *.json *.gif *.ttf *.woff recursive-include modoboa/core/templates *.tpl recursive-include modoboa/core/commands/templates *.tpl diff --git a/modoboa/core/tests/test_authentication.py b/modoboa/core/tests/test_authentication.py index e3e9a47d0..9e8e91230 100644 --- a/modoboa/core/tests/test_authentication.py +++ b/modoboa/core/tests/test_authentication.py @@ -4,12 +4,14 @@ from __future__ import unicode_literals import smtplib +from unittest import skipIf from mock import patch from django.core.urlresolvers import reverse from django.test import override_settings from modoboa.lib.tests import ModoTestCase +from modoboa.lib.tests import NO_SMTP from .. import factories from .. import models @@ -43,6 +45,7 @@ class AuthenticationTestCase(ModoTestCase): self.assertTrue(response.url.endswith(reverse("core:dashboard"))) +@skipIf(NO_SMTP, 'No SMTP server available') @override_settings(AUTHENTICATION_BACKENDS=( "modoboa.lib.authbackends.SMTPBackend", "django.contrib.auth.backends.ModelBackend" diff --git a/modoboa/lib/tests.py b/modoboa/lib/tests.py index e86d6a405..3fbab598a 100644 --- a/modoboa/lib/tests.py +++ b/modoboa/lib/tests.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals +import socket + from django.core import management from django.test import TestCase @@ -13,6 +15,13 @@ from modoboa.core import models as core_models from . import sysutils +try: + s = socket.create_connection(('127.0.0.1', 25)) + s.close() + NO_SMTP = False +except socket.error: + NO_SMTP = True + try: import ldap # NOQA NO_LDAP = False