diff --git a/openstack_dashboard/static/bootstrap/img/glyphicons-halflings-white.png b/horizon/static/bootstrap/img/glyphicons-halflings-white.png similarity index 100% rename from openstack_dashboard/static/bootstrap/img/glyphicons-halflings-white.png rename to horizon/static/bootstrap/img/glyphicons-halflings-white.png diff --git a/openstack_dashboard/static/bootstrap/img/glyphicons-halflings.png b/horizon/static/bootstrap/img/glyphicons-halflings.png similarity index 100% rename from openstack_dashboard/static/bootstrap/img/glyphicons-halflings.png rename to horizon/static/bootstrap/img/glyphicons-halflings.png diff --git a/openstack_dashboard/static/bootstrap/js/bootstrap.js b/horizon/static/bootstrap/js/bootstrap.js similarity index 100% rename from openstack_dashboard/static/bootstrap/js/bootstrap.js rename to horizon/static/bootstrap/js/bootstrap.js diff --git a/openstack_dashboard/static/bootstrap/js/bootstrap.min.js b/horizon/static/bootstrap/js/bootstrap.min.js similarity index 100% rename from openstack_dashboard/static/bootstrap/js/bootstrap.min.js rename to horizon/static/bootstrap/js/bootstrap.min.js diff --git a/openstack_dashboard/static/bootstrap/less/accordion.less b/horizon/static/bootstrap/less/accordion.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/accordion.less rename to horizon/static/bootstrap/less/accordion.less diff --git a/openstack_dashboard/static/bootstrap/less/alerts.less b/horizon/static/bootstrap/less/alerts.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/alerts.less rename to horizon/static/bootstrap/less/alerts.less diff --git a/openstack_dashboard/static/bootstrap/less/bootstrap.less b/horizon/static/bootstrap/less/bootstrap.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/bootstrap.less rename to horizon/static/bootstrap/less/bootstrap.less diff --git a/openstack_dashboard/static/bootstrap/less/breadcrumbs.less b/horizon/static/bootstrap/less/breadcrumbs.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/breadcrumbs.less rename to horizon/static/bootstrap/less/breadcrumbs.less diff --git a/openstack_dashboard/static/bootstrap/less/button-groups.less b/horizon/static/bootstrap/less/button-groups.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/button-groups.less rename to horizon/static/bootstrap/less/button-groups.less diff --git a/openstack_dashboard/static/bootstrap/less/buttons.less b/horizon/static/bootstrap/less/buttons.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/buttons.less rename to horizon/static/bootstrap/less/buttons.less diff --git a/openstack_dashboard/static/bootstrap/less/carousel.less b/horizon/static/bootstrap/less/carousel.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/carousel.less rename to horizon/static/bootstrap/less/carousel.less diff --git a/openstack_dashboard/static/bootstrap/less/close.less b/horizon/static/bootstrap/less/close.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/close.less rename to horizon/static/bootstrap/less/close.less diff --git a/openstack_dashboard/static/bootstrap/less/code.less b/horizon/static/bootstrap/less/code.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/code.less rename to horizon/static/bootstrap/less/code.less diff --git a/openstack_dashboard/static/bootstrap/less/component-animations.less b/horizon/static/bootstrap/less/component-animations.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/component-animations.less rename to horizon/static/bootstrap/less/component-animations.less diff --git a/openstack_dashboard/static/bootstrap/less/dropdowns.less b/horizon/static/bootstrap/less/dropdowns.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/dropdowns.less rename to horizon/static/bootstrap/less/dropdowns.less diff --git a/openstack_dashboard/static/bootstrap/less/forms.less b/horizon/static/bootstrap/less/forms.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/forms.less rename to horizon/static/bootstrap/less/forms.less diff --git a/openstack_dashboard/static/bootstrap/less/grid.less b/horizon/static/bootstrap/less/grid.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/grid.less rename to horizon/static/bootstrap/less/grid.less diff --git a/openstack_dashboard/static/bootstrap/less/hero-unit.less b/horizon/static/bootstrap/less/hero-unit.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/hero-unit.less rename to horizon/static/bootstrap/less/hero-unit.less diff --git a/openstack_dashboard/static/bootstrap/less/labels.less b/horizon/static/bootstrap/less/labels.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/labels.less rename to horizon/static/bootstrap/less/labels.less diff --git a/openstack_dashboard/static/bootstrap/less/layouts.less b/horizon/static/bootstrap/less/layouts.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/layouts.less rename to horizon/static/bootstrap/less/layouts.less diff --git a/openstack_dashboard/static/bootstrap/less/mixins.less b/horizon/static/bootstrap/less/mixins.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/mixins.less rename to horizon/static/bootstrap/less/mixins.less diff --git a/openstack_dashboard/static/bootstrap/less/modals.less b/horizon/static/bootstrap/less/modals.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/modals.less rename to horizon/static/bootstrap/less/modals.less diff --git a/openstack_dashboard/static/bootstrap/less/navbar.less b/horizon/static/bootstrap/less/navbar.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/navbar.less rename to horizon/static/bootstrap/less/navbar.less diff --git a/openstack_dashboard/static/bootstrap/less/navs.less b/horizon/static/bootstrap/less/navs.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/navs.less rename to horizon/static/bootstrap/less/navs.less diff --git a/openstack_dashboard/static/bootstrap/less/pager.less b/horizon/static/bootstrap/less/pager.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/pager.less rename to horizon/static/bootstrap/less/pager.less diff --git a/openstack_dashboard/static/bootstrap/less/pagination.less b/horizon/static/bootstrap/less/pagination.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/pagination.less rename to horizon/static/bootstrap/less/pagination.less diff --git a/openstack_dashboard/static/bootstrap/less/popovers.less b/horizon/static/bootstrap/less/popovers.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/popovers.less rename to horizon/static/bootstrap/less/popovers.less diff --git a/openstack_dashboard/static/bootstrap/less/progress-bars.less b/horizon/static/bootstrap/less/progress-bars.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/progress-bars.less rename to horizon/static/bootstrap/less/progress-bars.less diff --git a/openstack_dashboard/static/bootstrap/less/reset.less b/horizon/static/bootstrap/less/reset.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/reset.less rename to horizon/static/bootstrap/less/reset.less diff --git a/openstack_dashboard/static/bootstrap/less/responsive.less b/horizon/static/bootstrap/less/responsive.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/responsive.less rename to horizon/static/bootstrap/less/responsive.less diff --git a/openstack_dashboard/static/bootstrap/less/scaffolding.less b/horizon/static/bootstrap/less/scaffolding.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/scaffolding.less rename to horizon/static/bootstrap/less/scaffolding.less diff --git a/openstack_dashboard/static/bootstrap/less/sprites.less b/horizon/static/bootstrap/less/sprites.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/sprites.less rename to horizon/static/bootstrap/less/sprites.less diff --git a/openstack_dashboard/static/bootstrap/less/tables.less b/horizon/static/bootstrap/less/tables.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/tables.less rename to horizon/static/bootstrap/less/tables.less diff --git a/openstack_dashboard/static/bootstrap/less/thumbnails.less b/horizon/static/bootstrap/less/thumbnails.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/thumbnails.less rename to horizon/static/bootstrap/less/thumbnails.less diff --git a/openstack_dashboard/static/bootstrap/less/tooltip.less b/horizon/static/bootstrap/less/tooltip.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/tooltip.less rename to horizon/static/bootstrap/less/tooltip.less diff --git a/openstack_dashboard/static/bootstrap/less/type.less b/horizon/static/bootstrap/less/type.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/type.less rename to horizon/static/bootstrap/less/type.less diff --git a/openstack_dashboard/static/bootstrap/less/utilities.less b/horizon/static/bootstrap/less/utilities.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/utilities.less rename to horizon/static/bootstrap/less/utilities.less diff --git a/openstack_dashboard/static/bootstrap/less/variables.less b/horizon/static/bootstrap/less/variables.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/variables.less rename to horizon/static/bootstrap/less/variables.less diff --git a/openstack_dashboard/static/bootstrap/less/wells.less b/horizon/static/bootstrap/less/wells.less similarity index 100% rename from openstack_dashboard/static/bootstrap/less/wells.less rename to horizon/static/bootstrap/less/wells.less diff --git a/openstack_dashboard/templates/_header.html b/horizon/templates/_header.html similarity index 100% rename from openstack_dashboard/templates/_header.html rename to horizon/templates/_header.html diff --git a/horizon/tests/templates/splash.html b/horizon/templates/_stylesheets.html similarity index 100% rename from horizon/tests/templates/splash.html rename to horizon/templates/_stylesheets.html diff --git a/openstack_dashboard/templates/auth/_login.html b/horizon/templates/auth/_login.html similarity index 100% rename from openstack_dashboard/templates/auth/_login.html rename to horizon/templates/auth/_login.html diff --git a/openstack_dashboard/templates/auth/login.html b/horizon/templates/auth/login.html similarity index 100% rename from openstack_dashboard/templates/auth/login.html rename to horizon/templates/auth/login.html diff --git a/openstack_dashboard/templates/base.html b/horizon/templates/base.html similarity index 100% rename from openstack_dashboard/templates/base.html rename to horizon/templates/base.html diff --git a/openstack_dashboard/templates/splash.html b/horizon/templates/splash.html similarity index 100% rename from openstack_dashboard/templates/splash.html rename to horizon/templates/splash.html diff --git a/horizon/test.py b/horizon/test.py index bc166fd01..e0844eb84 100644 --- a/horizon/test.py +++ b/horizon/test.py @@ -30,10 +30,12 @@ from django.contrib.messages.storage import default_storage from django.contrib.auth.middleware import AuthenticationMiddleware from django.core.handlers import wsgi from django.test.client import RequestFactory +from django.utils import unittest from glanceclient.v1 import client as glance_client from keystoneclient.v2_0 import client as keystone_client from novaclient.v1_1 import client as nova_client +from selenium.webdriver.firefox.webdriver import WebDriver import httplib2 import mox @@ -325,3 +327,19 @@ class APITestCase(TestCase): .AndReturn(self.swiftclient) expected_calls -= 1 return self.swiftclient + + +@unittest.skipUnless(os.environ.get('WITH_SELENIUM', False), + "The WITH_SELENIUM env variable is not set.") +class SeleniumTestCase(django_test.LiveServerTestCase): + @classmethod + def setUpClass(cls): + if os.environ.get('WITH_SELENIUM', False): + cls.selenium = WebDriver() + super(SeleniumTestCase, cls).setUpClass() + + @classmethod + def tearDownClass(cls): + super(SeleniumTestCase, cls).tearDownClass() + if os.environ.get('WITH_SELENIUM', False): + cls.selenium.quit() diff --git a/horizon/tests/base_tests.py b/horizon/tests/base_tests.py index bcd9c0d5a..011eecded 100644 --- a/horizon/tests/base_tests.py +++ b/horizon/tests/base_tests.py @@ -49,14 +49,14 @@ class MyPanel(horizon.Panel): name = _("My Panel") slug = "myslug" permissions = ("openstack.services.compute",) - urls = 'horizon.tests.test_panel_urls' + urls = 'horizon.tests.test_dashboards.cats.kittens.urls' class AdminPanel(horizon.Panel): name = _("Admin Panel") slug = "admin_panel" permissions = ("openstack.roles.admin",) - urls = 'horizon.tests.test_panel_urls' + urls = 'horizon.tests.test_dashboards.cats.kittens.urls' class BaseHorizonTests(test.TestCase): @@ -256,6 +256,13 @@ class HorizonTests(BaseHorizonTests): panel = dash.get_panel('myslug') self._reload_urls() + # Set roles for admin user + self.setActiveUser(token=self.token, + username=self.user.name, + tenant_id=self.tenant.id, + service_catalog=self.request.user.service_catalog, + roles=[{'name': 'admin'}]) + # With the required service, the page returns fine. resp = self.client.get(panel.get_absolute_url()) self.assertEqual(resp.status_code, 200) diff --git a/horizon/tests/selenium_tests.py b/horizon/tests/selenium_tests.py new file mode 100644 index 000000000..f38118482 --- /dev/null +++ b/horizon/tests/selenium_tests.py @@ -0,0 +1,38 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 Nebula, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from horizon import test + +import selenium.webdriver.support.ui as ui + + +class BrowserTests(test.SeleniumTestCase): + def test_splash(self): + 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.get("%s%s" % (self.live_server_url, "/qunit/")) + wait = ui.WebDriverWait(self.selenium, 10) + + def qunit_done(driver): + text = driver.find_element_by_id("qunit-testresult").text + return "Tests completed" in text + + wait.until(qunit_done) + failed = self.selenium.find_element_by_class_name("failed") + self.assertEqual(int(failed.text), 0) diff --git a/horizon/tests/templates/base.html b/horizon/tests/templates/base.html deleted file mode 100644 index d813b9a4b..000000000 --- a/horizon/tests/templates/base.html +++ /dev/null @@ -1,34 +0,0 @@ -{% load branding i18n %} - - - - - {% block title %}{% endblock %} - {% site_branding %} - {% include "horizon/_conf.html" %} - {% include "horizon/client_side/_script_loader.html" %} - - - {% block content %} -
- {% block sidebar %} - {% include 'horizon/common/_sidebar.html' %} - {% endblock %} -
-
- {% include "_header.html" %} - {% block page_header %}{% endblock %} -
- {% include "horizon/_messages.html" %} - {% block main %}{% endblock %} -
-
- {% endblock %} - - {% block js %} - {% include "horizon/_scripts.html" %} - {% endblock %} -