[python-django-horizon] execute tests during build (fixes rhbz#856182)

Matthias Runge mrunge at fedoraproject.org
Tue Aug 27 11:31:19 UTC 2013


commit 10472701b4b841e2fae345ab674c3add4adfdbb5
Author: Matthias Runge <mrunge at redhat.com>
Date:   Tue Aug 27 13:25:52 2013 +0200

    execute tests during build (fixes rhbz#856182)

 fix-tests.patch            |   94 ++++++++++++++++++++++++++++++++++++++++++++
 python-django-horizon.spec |   35 +++++++++++++----
 2 files changed, 121 insertions(+), 8 deletions(-)
---
diff --git a/fix-tests.patch b/fix-tests.patch
new file mode 100644
index 0000000..f9d86b4
--- /dev/null
+++ b/fix-tests.patch
@@ -0,0 +1,94 @@
+From 355c9ccf90e9787b4f10fefba156569df79e4e8c Mon Sep 17 00:00:00 2001
+From: Lin Hua Cheng <lin-hua.cheng at hp.com>
+Date: Thu, 1 Aug 2013 20:50:51 -0700
+Subject: [PATCH] Fixed keystone test data to match openstack_auth.
+
+Fixes bug 1207599
+
+Change-Id: I2cc333911cc0d07cab9c0c550a8d0d69f374634c
+---
+ .../test/test_data/keystone_data.py                | 54 +++++++++++++++-------
+ 1 file changed, 37 insertions(+), 17 deletions(-)
+
+diff --git a/openstack_dashboard/test/test_data/keystone_data.py b/openstack_dashboard/test/test_data/keystone_data.py
+index b9d4192..e92131b 100644
+--- a/openstack_dashboard/test/test_data/keystone_data.py
++++ b/openstack_dashboard/test/test_data/keystone_data.py
+@@ -17,14 +17,15 @@
+ from django.conf import settings
+ from django.utils import datetime_safe
+ 
++from keystoneclient.access import AccessInfo
+ from keystoneclient.v2_0 import ec2
+ from keystoneclient.v2_0 import roles
+ from keystoneclient.v2_0 import tenants
+-from keystoneclient.v2_0 import tokens
+ from keystoneclient.v2_0 import users
+ from keystoneclient.v3 import domains
+ from keystoneclient.v3 import groups
+ 
++from openstack_auth.user import Token
+ 
+ from openstack_dashboard.test.test_data.utils import TestDataContainer
+ 
+@@ -223,22 +224,41 @@ def data(TEST):
+     tomorrow = datetime_safe.datetime.now() + timedelta(days=1)
+     expiration = datetime_safe.datetime.isoformat(tomorrow)
+ 
+-    scoped_token = tokens.Token(tokens.TokenManager,
+-                                dict(token={"id": "test_token_id",
+-                                            "expires": expiration,
+-                                            "tenant": tenant_dict,
+-                                            "tenants": [tenant_dict]},
+-                                     user={"id": "test_user_id",
+-                                           "name": "test_user",
+-                                           "roles": [member_role_dict]},
+-                                     serviceCatalog=TEST.service_catalog))
+-    unscoped_token = tokens.Token(tokens.TokenManager,
+-                                  dict(token={"id": "test_token_id",
+-                                              "expires": expiration},
+-                                       user={"id": "test_user_id",
+-                                             "name": "test_user",
+-                                             "roles": [member_role_dict]},
+-                                       serviceCatalog=TEST.service_catalog))
++    scoped_token_dict = {
++        'access': {
++            'token': {
++                'id': "test_token_id",
++                'expires': expiration,
++                'tenant': tenant_dict,
++                'tenants': [tenant_dict]},
++            'user': {
++                'id': "test_user_id",
++                'name': "test_user",
++                'roles': [member_role_dict]},
++            'serviceCatalog': TEST.service_catalog
++        }
++    }
++
++    scoped_access_info = AccessInfo.factory(resp=None,
++                                            body=scoped_token_dict)
++
++    unscoped_token_dict = {
++        'access': {
++            'token': {
++                'id': "test_token_id",
++                'expires': expiration},
++            'user': {
++                     'id': "test_user_id",
++                     'name': "test_user",
++                     'roles': [member_role_dict]},
++            'serviceCatalog': TEST.service_catalog
++        }
++    }
++    unscoped_access_info = AccessInfo.factory(resp=None,
++                                              body=unscoped_token_dict)
++
++    scoped_token = Token(scoped_access_info)
++    unscoped_token = Token(unscoped_access_info)
+     TEST.tokens.add(scoped_token, unscoped_token)
+     TEST.token = scoped_token  # your "current" token.
+     TEST.tokens.scoped_token = scoped_token
+-- 
+1.8.1.6
+
diff --git a/python-django-horizon.spec b/python-django-horizon.spec
index 3c0e361..3318eea 100644
--- a/python-django-horizon.spec
+++ b/python-django-horizon.spec
@@ -1,6 +1,6 @@
 Name:       python-django-horizon
 Version:    2013.2
-Release:    0.6b2%{?dist}
+Release:    0.7b2%{?dist}
 Summary:    Django application for talking to Openstack
 
 Group:      Development/Libraries
@@ -22,6 +22,9 @@ Patch0001: 0001-Don-t-access-the-net-while-building-docs.patch
 Patch0002: 0002-disable-debug-move-web-root.patch
 Patch0003: 0003-change-lockfile-location-to-tmp-and-also-add-localho.patch
 
+# patch will be included in 2013.2.b3
+Patch99: fix-tests.patch
+
 
 # epel6 has a separate Django14 package
 %if 0%{?rhel}==6
@@ -44,11 +47,18 @@ BuildRequires: python-pbr
 BuildRequires: python-lockfile
 
 # for checks:
-#BuildRequires:   python-django-nose
-#BuildRequires:   python-cinderclient
-#BuildRequires:   python-django-appconf
-#BuildRequires:   python-django-openstack-auth
-#BuildRequires:   python-django-compressor
+BuildRequires:   python-django-nose
+BuildRequires:   python-coverage
+BuildRequires:   python-mox
+BuildRequires:   python-nose-exclude
+BuildRequires:   python-netaddr
+BuildRequires:   python-eventlet
+BuildRequires:   python-kombu
+BuildRequires:   python-anyjson
+BuildRequires:   pytz
+BuildRequires:   python-iso8601
+BuildRequires:   python-nose
+
 
 # additional provides to be consistent with other django packages
 Provides: django-horizon = %{version}-%{release}
@@ -79,6 +89,7 @@ Requires:   python-cinderclient
 Requires:   python-swiftclient
 Requires:   python-heatclient
 Requires:   python-ceilometerclient
+Requires:   python-netaddr
 
 BuildRequires: python2-devel
 BuildRequires: python-django-openstack-auth >= 1.0.11
@@ -109,7 +120,7 @@ BuildRequires: python-sphinx >= 1.1.3
 # Doc building basically means we have to mirror Requires:
 BuildRequires: python-dateutil
 BuildRequires: python-glanceclient
-BuildRequires: python-keystoneclient
+BuildRequires: python-keystoneclient >= 0.3
 BuildRequires: python-novaclient >= 2012.1
 BuildRequires: python-neutronclient
 BuildRequires: python-cinderclient
@@ -127,6 +138,8 @@ Documentation for the Django Horizon application for talking with Openstack
 %patch0001 -p1
 %patch0002 -p1
 %patch0003 -p1
+
+%patch99 -p1
 # remove unnecessary .po files
 find . -name "django*.po" -exec rm -f '{}' \;
 
@@ -174,7 +187,7 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/openstack-dashboard
 # Copy everything to /usr/share
 mv %{buildroot}%{python_sitelib}/openstack_dashboard \
    %{buildroot}%{_datadir}/openstack-dashboard
-mv manage.py %{buildroot}%{_datadir}/openstack-dashboard
+cp manage.py %{buildroot}%{_datadir}/openstack-dashboard
 rm -rf %{buildroot}%{python_sitelib}/openstack_dashboard
 
 
@@ -210,6 +223,9 @@ mkdir -p %{buildroot}%{_datadir}/openstack-dashboard/static
 cp -a openstack_dashboard/static/* %{buildroot}%{_datadir}/openstack-dashboard/static
 cp -a horizon/static/* %{buildroot}%{_datadir}/openstack-dashboard/static 
 
+%check
+./run_tests.sh -N
+
 %files -f horizon.lang
 %doc LICENSE README.rst openstack-dashboard-httpd-logging.conf
 %dir %{python_sitelib}/horizon
@@ -257,6 +273,9 @@ cp -a horizon/static/* %{buildroot}%{_datadir}/openstack-dashboard/static
 %doc html 
 
 %changelog
+* Mon Aug 26 2013 Matthias Runge <mrunge at redhat.com> - 2013.2-0.7b2
+- enable tests in check section (rhbz#856182)
+
 * Wed Aug 07 2013 Matthias Runge <mrunge at redhat.com> - 2013.2-0.5b2
 - move requirements from horizon to openstack-dashboard package
 - introduce explicit requirements for dependencies


More information about the scm-commits mailing list