diff --git a/atst/app.py b/atst/app.py index 68ebd331..8bfcb134 100644 --- a/atst/app.py +++ b/atst/app.py @@ -98,6 +98,7 @@ def map_config(config): "default", "PERMANENT_SESSION_LIFETIME" ), "RQ_REDIS_URL": config["default"]["REDIS_URI"], + "RQ_QUEUES": ["atat_{}".format(ENV.lower())], } diff --git a/atst/utils/mailer.py b/atst/utils/mailer.py index f98c7e5d..a2b7aeb2 100644 --- a/atst/utils/mailer.py +++ b/atst/utils/mailer.py @@ -33,7 +33,6 @@ class BaseMailer: self.sender = sender self.password = password self.use_tls = use_tls - self.messages = [] def _message(self, recipients, subject, body): msg = EmailMessage() @@ -47,10 +46,17 @@ class BaseMailer: def send(self, recipients, subject, body): pass + # do not collect messages by default + @property + def messages(self): + return [] + class Mailer(BaseMailer): def connection(self): - return _HostConnection(self.server, self.port, self.sender, self.password, use_tls=self.use_tls) + return _HostConnection( + self.server, self.port, self.sender, self.password, use_tls=self.use_tls + ) def send(self, recipients, subject, body): message = self._message(recipients, subject, body) diff --git a/tests/conftest.py b/tests/conftest.py index 9c3c2296..50a555e7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,7 +23,6 @@ def app(request): config = make_config() config.update({"STORAGE_CONTAINER": upload_dir.name}) - config.update({"RQ_QUEUES": ["test"]}) _app = make_app(config) diff --git a/tests/test_queue.py b/tests/test_queue.py index ff634347..20331c1e 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -8,6 +8,7 @@ def reset_queue(): yield queue.get_queue().empty() + def test_send_mail(): assert len(queue.get_queue()) == 0 send_mail.queue(