summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2010-11-08 11:50:06 +1000
committerDan Callaghan <dcallagh@redhat.com>2010-11-08 13:31:14 +1000
commite5cc5ab8b2eff2c9440e5a480fbc097f037ee8bd (patch)
tree44d8daf8de3603d5cb76f863e7355184e18f69fd
parent9571cb0821486d66183b18f8d237e8ce116f1405 (diff)
absolute urls in mails will vary according to where we are runningbeaker-distribution-beaker-setup-1_1-59
-rw-r--r--Server/bkr/server/test/__init__.py5
-rw-r--r--Server/bkr/server/test/selenium/__init__.py3
-rw-r--r--Server/bkr/server/test/selenium/test_report_problem.py7
-rw-r--r--Server/bkr/server/test/test_mail.py7
-rwxr-xr-xTasks/distribution/beaker/setup/runtest.sh3
5 files changed, 17 insertions, 8 deletions
diff --git a/Server/bkr/server/test/__init__.py b/Server/bkr/server/test/__init__.py
index c92daf5..149b743 100644
--- a/Server/bkr/server/test/__init__.py
+++ b/Server/bkr/server/test/__init__.py
@@ -20,6 +20,7 @@ import sys
import os
from StringIO import StringIO
import logging, logging.config
+import turbogears
from turbogears import update_config
from turbogears.database import session
import turbomail.adapters.tg1
@@ -29,6 +30,10 @@ log = logging.getLogger(__name__)
CONFIG_FILE = os.environ.get('BEAKER_CONFIG_FILE', 'test.cfg')
+def get_server_base():
+ return os.environ.get('BEAKER_SERVER_BASE_URL',
+ 'http://localhost:%s/' % turbogears.config.get('server.socket_port'))
+
def setup_package():
log.info('Loading test configuration from %s', CONFIG_FILE)
assert os.path.exists(CONFIG_FILE), 'Config file %s must exist' % CONFIG_FILE
diff --git a/Server/bkr/server/test/selenium/__init__.py b/Server/bkr/server/test/selenium/__init__.py
index d6b0b5c..69ca7d7 100644
--- a/Server/bkr/server/test/selenium/__init__.py
+++ b/Server/bkr/server/test/selenium/__init__.py
@@ -43,8 +43,7 @@ class SeleniumTestCase(unittest.TestCase):
@classmethod
def get_selenium(cls):
cls.sel = selenium('localhost', 4444, '*chrome',
- os.environ.get('BEAKER_SERVER_BASE_URL', 'http://localhost:%s/'
- % turbogears.config.get('server.socket_port')))
+ bkr.server.test.get_server_base())
return cls.sel
@classmethod
diff --git a/Server/bkr/server/test/selenium/test_report_problem.py b/Server/bkr/server/test/selenium/test_report_problem.py
index 0804802..5330b77 100644
--- a/Server/bkr/server/test/selenium/test_report_problem.py
+++ b/Server/bkr/server/test/selenium/test_report_problem.py
@@ -23,7 +23,7 @@ from turbogears.database import session
from bkr.server.test.selenium import SeleniumTestCase
from bkr.server.test.mail_capture import MailCaptureThread
-from bkr.server.test import data_setup
+from bkr.server.test import data_setup, get_server_base
class TestReportProblem(SeleniumTestCase):
@@ -71,10 +71,11 @@ class TestReportProblem(SeleniumTestCase):
self.assertEqual(msg['X-Beaker-System'], 'ncc1701d')
self.assertEqual(msg.get_payload(),
'A Beaker user has reported a problem with system \n'
- 'ncc1701d <http://localhost:9090/view/ncc1701d>.\n\n'
+ 'ncc1701d <%sview/ncc1701d>.\n\n'
'Reported by: Beverley Crusher\n\n'
'Problem description:\n'
- 'Make it so!')
+ 'Make it so!'
+ % get_server_base())
def test_reporting_problem_requires_login(self):
system = data_setup.create_system()
diff --git a/Server/bkr/server/test/test_mail.py b/Server/bkr/server/test/test_mail.py
index d4c7932..1ed13ff 100644
--- a/Server/bkr/server/test/test_mail.py
+++ b/Server/bkr/server/test/test_mail.py
@@ -20,7 +20,7 @@ import sys
import email
import unittest
from turbogears.database import session
-from bkr.server.test import data_setup, mail_capture
+from bkr.server.test import data_setup, mail_capture, get_server_base
import bkr.server.mail
class MailTest(unittest.TestCase):
@@ -51,10 +51,11 @@ class MailTest(unittest.TestCase):
self.assertEqual(msg['X-Beaker-System'], 'home-one')
self.assertEqual(msg.get_payload(),
'Beaker has automatically marked system \n'
- 'home-one <http://localhost:9090/view/home-one> \n'
+ 'home-one <%sview/home-one> \n'
'as broken, due to:\n\n'
'It\'s a tarp!\n\n'
'Please investigate this error and take appropriate action.\n\n'
'Power type: drac\n'
'Power address: pdu2.home-one\n'
- 'Power id: 42')
+ 'Power id: 42'
+ % get_server_base())
diff --git a/Tasks/distribution/beaker/setup/runtest.sh b/Tasks/distribution/beaker/setup/runtest.sh
index 6fd493c..a7d61ee 100755
--- a/Tasks/distribution/beaker/setup/runtest.sh
+++ b/Tasks/distribution/beaker/setup/runtest.sh
@@ -212,6 +212,9 @@ identity.krb_auth_keytab='/etc/httpd/conf/httpd.keytab'
# SERVER
+tg.url_domain='localhost'
+tg.url_scheme='http'
+
server.socket_port=8084
server.environment="development"
server.webpath="/bkr/"