From b3c49ab78a6861c6c63800ca76d590d25efa495a Mon Sep 17 00:00:00 2001
From: Radomir Dopieralski <openstack@sheep.art.pl>
Date: Mon, 24 Nov 2014 16:11:02 +0100
Subject: [PATCH] Make the tests run

The run_tests.sh was just blindly copied from tuskar_ui and didn't work
properly or run the local tests. This patch fixes the paths and adds
local settings.py file that loads both plugins.

Change-Id: I1b6c0a7a149201325638db39196f3c113a881820
---
 requirements.txt                  |  2 --
 run_tests.sh                      | 15 ++++++++-------
 test-requirements.txt             |  2 +-
 test/__init__.py                  |  0
 test/enabled/_60_tuskar_boxes.py  |  1 +
 test/enabled/_60_tuskar_sat_ui.py |  1 +
 test/enabled/__init__.py          |  0
 test/settings.py                  |  9 +++++++++
 8 files changed, 20 insertions(+), 10 deletions(-)
 create mode 100644 test/__init__.py
 create mode 120000 test/enabled/_60_tuskar_boxes.py
 create mode 120000 test/enabled/_60_tuskar_sat_ui.py
 create mode 100644 test/enabled/__init__.py
 create mode 100644 test/settings.py

diff --git a/requirements.txt b/requirements.txt
index 7a74c5e..7dfed9a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1 @@
 pbr>=0.6,!=0.7,<1.0
-horizon
-tuskar-ui
diff --git a/run_tests.sh b/run_tests.sh
index 664f34d..bca1b2f 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -54,7 +54,7 @@ function usage {
 root=`pwd`
 venv=$root/.venv
 with_venv=tools/with_venv.sh
-included_dirs="tuskar_ui"
+included_dirs="tuskar_sat_ui tuskar_boxes"
 
 always_venv=0
 backup_env=0
@@ -145,12 +145,13 @@ function run_pylint {
 
 function run_jshint {
   echo "Running jshint ..."
-  jshint tuskar_ui/infrastructure/static/infrastructure
+  jshint tuskar_boxes
+  jshint tuskar_sat_ui
 }
 
 function run_pep8 {
   echo "Running flake8 ..."
-  DJANGO_SETTINGS_MODULE=tuskar_ui.test.settings ${command_wrapper} flake8 $included_dirs
+  DJANGO_SETTINGS_MODULE=test.settings ${command_wrapper} flake8 $included_dirs
 }
 
 function run_sphinx {
@@ -310,13 +311,13 @@ function run_tests_subset {
 }
 
 function run_tests_all {
-  echo "Running Tuskar-UI application tests"
-  export NOSE_XUNIT_FILE=tuskar_ui/nosetests.xml
+  echo "Running Tuskar-UI-Extras application tests"
+  export NOSE_XUNIT_FILE=test/nosetests.xml
   if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then
-    export NOSE_HTML_OUT_FILE='tuskar_ui_nose_results.html'
+    export NOSE_HTML_OUT_FILE='tuskar_ui_extras_nose_results.html'
   fi
   ${command_wrapper} ${COVERAGE_CMD} erase
-  ${command_wrapper} ${COVERAGE_CMD} run -p $root/manage.py test tuskar_ui --settings=tuskar_ui.test.settings $testopts
+  ${command_wrapper} ${COVERAGE_CMD} run -p $root/manage.py test tuskar_boxes tuskar_sat_ui --settings=test.settings $testopts
   # get results of the Horizon tests
   TUSKAR_UI_RESULT=$?
 
diff --git a/test-requirements.txt b/test-requirements.txt
index 21c9cf2..7a214ba 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -20,4 +20,4 @@ docutils==0.9.1
 oslosphinx
 
 http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
-http://tarballs.openstack.org/horizon/tuskar-ui-master.tar.gz#egg=tuskar-ui
+http://tarballs.openstack.org/tuskar-ui/tuskar-ui-master.tar.gz#egg=tuskar-ui
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/test/enabled/_60_tuskar_boxes.py b/test/enabled/_60_tuskar_boxes.py
new file mode 120000
index 0000000..221f8ac
--- /dev/null
+++ b/test/enabled/_60_tuskar_boxes.py
@@ -0,0 +1 @@
+../../_60_tuskar_boxes.py.example
\ No newline at end of file
diff --git a/test/enabled/_60_tuskar_sat_ui.py b/test/enabled/_60_tuskar_sat_ui.py
new file mode 120000
index 0000000..314d7d4
--- /dev/null
+++ b/test/enabled/_60_tuskar_sat_ui.py
@@ -0,0 +1 @@
+../../_60_tuskar_sat_ui.py.example
\ No newline at end of file
diff --git a/test/enabled/__init__.py b/test/enabled/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/test/settings.py b/test/settings.py
new file mode 100644
index 0000000..23ccb81
--- /dev/null
+++ b/test/settings.py
@@ -0,0 +1,9 @@
+import openstack_dashboard.enabled
+from openstack_dashboard.utils import settings
+import test.enabled
+from tuskar_ui.test.settings import *  # noqa
+
+
+INSTALLED_APPS = list(INSTALLED_APPS)  # Make sure it's mutable
+settings.update_dashboards([openstack_dashboard.enabled, test.enabled],
+                           HORIZON_CONFIG, INSTALLED_APPS)