Fix running "./manage.py test zephyr --settings=humbug.test_settings"

Previously it wouldn't work due to using the wrong port numbers.

This commit also has the side effect of fixing the fact that our
frontend tests would send real emails and log events to the real
message log.

(imported from commit f2cf400e6061c089627acba2759d588981ecf5bb)
This commit is contained in:
Tim Abbott 2013-01-10 13:05:53 -05:00
parent 536027aa66
commit 52589ca6fb
3 changed files with 13 additions and 6 deletions

View File

@ -1,10 +1,14 @@
from settings import *
import os
DATABASES["default"] = {"NAME": "zephyr/tests/zephyrdb.test",
"ENGINE": "django.db.backends.sqlite3",
"OPTIONS": { "timeout": 20, },}
TORNADO_SERVER = 'http://localhost:9983'
if "TORNADO_SERVER" in os.environ:
TORNADO_SERVER = os.environ["TORNADO_SERVER"]
else:
TORNADO_SERVER = None
# Decrease the get_updates timeout to 1 second.
# This allows CasperJS to proceed quickly to the next test step.
@ -13,3 +17,9 @@ POLL_TIMEOUT = 1000
# Disable desktop notifications because CasperJS can't handle them;
# window.webkitNotifications.requestPermission() throws a type error
ENABLE_NOTIFICATIONS = False
# Don't use the real message log for tests
MESSAGE_LOG = "/tmp/test-message-log"
# Print our emails rather than sending them
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'

View File

@ -17,11 +17,6 @@ import optparse
from django.conf import settings
import re
settings.MESSAGE_LOG = "/tmp/test-message-log"
settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
settings.TORNADO_SERVER = None
def find_key_by_email(address):
from django.core.mail import outbox
key_regex = re.compile("accounts/do_confirm/([a-f0-9]{40})>")

View File

@ -6,6 +6,8 @@ import sys
import os
from os import path
os.environ["TORNADO_SERVER"] = "http://localhost:9983"
os.chdir(path.join(path.dirname(__file__), '../../..'))
subprocess.check_call('zephyr/tests/generate-fixtures')