summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--horizon/tests/testsettings.py9
-rw-r--r--horizon/tests/testurls.py2
-rw-r--r--openstack_dashboard/settings.py22
-rw-r--r--openstack_dashboard/test/__init__.py0
-rw-r--r--openstack_dashboard/test/settings.py11
-rw-r--r--openstack_dashboard/tests.py34
-rwxr-xr-xrun_tests.sh14
-rw-r--r--tools/pip-requires16
-rw-r--r--tools/test-requires4
9 files changed, 55 insertions, 57 deletions
diff --git a/horizon/tests/testsettings.py b/horizon/tests/testsettings.py
index 8815e003..aba0aec5 100644
--- a/horizon/tests/testsettings.py
+++ b/horizon/tests/testsettings.py
@@ -59,6 +59,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.messages.context_processors.messages',
'horizon.context_processors.horizon')
+STATIC_URL = '/static/'
+
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
ROOT_URLCONF = 'horizon.tests.testurls'
@@ -72,11 +74,12 @@ NOSE_ARGS = ['--nocapture',
'--nologcapture',
'--cover-package=horizon',
'--cover-inclusive']
-# For nose-selenium integration
-LIVE_SERVER_PORT = 8000
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
-SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
+SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
+SESSION_COOKIE_HTTPONLY = True
+SESSION_EXPIRE_AT_BROWSER_CLOSE = True
+SESSION_COOKIE_SECURE = False
HORIZON_CONFIG = {
'dashboards': ('nova', 'syspanel', 'settings',),
diff --git a/horizon/tests/testurls.py b/horizon/tests/testurls.py
index fc07df9b..a553d153 100644
--- a/horizon/tests/testurls.py
+++ b/horizon/tests/testurls.py
@@ -22,7 +22,7 @@
URL patterns for testing Horizon views.
"""
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url, include
import horizon
diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py
index 5153759f..59fc27fc 100644
--- a/openstack_dashboard/settings.py
+++ b/openstack_dashboard/settings.py
@@ -94,19 +94,20 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- 'django_nose',
'horizon',
'horizon.dashboards.nova',
'horizon.dashboards.syspanel',
'horizon.dashboards.settings',
)
-TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
-SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
+SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
+SESSION_COOKIE_HTTPONLY = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
+SESSION_COOKIE_SECURE = False
+
TIME_ZONE = None
gettext_noop = lambda s: s
LANGUAGES = (
@@ -123,12 +124,7 @@ LANGUAGES = (
LANGUAGE_CODE = 'en'
USE_I18N = True
-ACCOUNT_ACTIVATION_DAYS = 7
-
-TOTAL_CLOUD_RAM_GB = 10
-
OPENSTACK_KEYSTONE_DEFAULT_ROLE = 'Member'
-LIVE_SERVER_PORT = 8000
try:
from local.local_settings import *
@@ -137,13 +133,3 @@ except ImportError:
if DEBUG:
logging.basicConfig(level=logging.DEBUG)
-
- try:
- import debug_toolbar
-
- INSTALLED_APPS += ('debug_toolbar',)
- MIDDLEWARE_CLASSES += (
- 'debug_toolbar.middleware.DebugToolbarMiddleware',)
- except ImportError:
- _logger = logging.getLogger(__name__)
- _logger.debug('Running in debug mode without debug_toolbar.')
diff --git a/openstack_dashboard/test/__init__.py b/openstack_dashboard/test/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/openstack_dashboard/test/__init__.py
diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py
new file mode 100644
index 00000000..f903ca22
--- /dev/null
+++ b/openstack_dashboard/test/settings.py
@@ -0,0 +1,11 @@
+import os
+
+from horizon.tests.testsettings import *
+
+TEST_DIR = os.path.dirname(os.path.abspath(__file__))
+ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
+
+ROOT_URLCONF = 'openstack_dashboard.urls'
+TEMPLATE_DIRS = (os.path.join(ROOT_PATH, 'templates'),)
+STATICFILES_DIRS = (os.path.join(ROOT_PATH, 'static'),)
+INSTALLED_APPS += ('openstack_dashboard',)
diff --git a/openstack_dashboard/tests.py b/openstack_dashboard/tests.py
index 050aa94b..8d941ce3 100644
--- a/openstack_dashboard/tests.py
+++ b/openstack_dashboard/tests.py
@@ -1,13 +1,33 @@
+import os
+
from django import test
-from noseselenium.cases import SeleniumTestCaseMixin
+from django.utils import unittest
+
+from selenium.webdriver.firefox.webdriver import WebDriver
+
+
+@unittest.skipUnless(os.environ.get('WITH_SELENIUM', False),
+ "The WITH_SELENIUM env variable is not set.")
+class SeleniumTests(test.LiveServerTestCase):
+ @classmethod
+ def setUpClass(cls):
+ if os.environ.get('WITH_SELENIUM', False):
+ cls.selenium = WebDriver()
+ super(SeleniumTests, cls).setUpClass()
+ @classmethod
+ def tearDownClass(cls):
+ super(SeleniumTests, cls).tearDownClass()
+ if os.environ.get('WITH_SELENIUM', False):
+ cls.selenium.quit()
-class SeleniumTests(test.TestCase, SeleniumTestCaseMixin):
def test_splash(self):
- self.selenium.open("/")
- self.failUnless(self.selenium.is_text_present("User Name"))
+ self.selenium.get(self.live_server_url)
+ button = self.selenium.find_element_by_tag_name("button")
+ self.assertEqual(button.text, "Sign In")
def test_qunit(self):
- self.selenium.open("/qunit/")
- self.selenium.wait_for_page_to_load("2000")
- self.failUnless(self.selenium.is_text_present("0 failed"))
+ self.selenium.get("%s%s" % (self.live_server_url, "/qunit/")),
+ self.selenium.implicitly_wait("1000")
+ failed = self.selenium.find_element_by_class_name("failed")
+ self.assertEqual(int(failed.text), 0)
diff --git a/run_tests.sh b/run_tests.sh
index 86b8cc5b..6b853c74 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -6,7 +6,7 @@ set -o errexit
# Increment me any time the environment should be rebuilt.
# This includes dependncy changes, directory renames, etc.
# Simple integer secuence: 1, 2, 3...
-environment_version=14
+environment_version=15
#--------------------------------------------------------#
function usage {
@@ -201,13 +201,6 @@ function sanity_check {
exit 1
fi
fi
- if [ $selenium -eq 1 ]; then
- SELENIUM_JOB=`ps -elf | grep "selenium" | grep -v grep`
- if [ $? -eq 0 ]; then
- echo "WARNING: Selenium doesn't appear to be running. Please start a selenium server process."
- selenium=0
- fi
- fi
# Remove .pyc files. This is sanity checking because they can linger
# after old files are deleted.
find . -name "*.pyc" -exec rm -rf {} \;
@@ -276,10 +269,9 @@ function run_tests {
echo "Running openstack_dashboard tests"
if [ $selenium -eq 1 ]; then
- ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=horizon.tests.testsettings --with-selenium --with-cherrypyliveserver $testargs
- else
- ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=horizon.tests.testsettings $testargs
+ export WITH_SELENIUM=1
fi
+ ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testargs
# get results of the openstack_dashboard tests
DASHBOARD_RESULT=$?
diff --git a/tools/pip-requires b/tools/pip-requires
index 498cc1b0..db2d8237 100644
--- a/tools/pip-requires
+++ b/tools/pip-requires
@@ -1,21 +1,7 @@
# Horizon Core Requirements
-Django>=1.3
+Django>=1.4
python-cloudfiles
python-dateutil
-django-nose
-
-# Glance Requirements
-PasteDeploy
-eventlet
-kombu
-paste
-pycrypto==2.3
-routes
-sqlalchemy
-sqlalchemy-migrate
-webob==1.0.8
-xattr
-iso8601
# Horizon Non-pip Requirements
-e git+https://github.com/openstack/python-novaclient.git#egg=python-novaclient
diff --git a/tools/test-requires b/tools/test-requires
index c8fa4b42..da054d5e 100644
--- a/tools/test-requires
+++ b/tools/test-requires
@@ -1,12 +1,12 @@
# Testing Requirements
-CherryPy
coverage
-django-nose-selenium
+django-nose
mox
nose
pep8
pylint
distribute>=0.6.24
+selenium
# Docs Requirements
sphinx