[python-django-piston] Added tests

Miro Hrončok churchyard at fedoraproject.org
Wed Jun 5 12:40:53 UTC 2013


commit a3b7d58e06aed272b7a45b093b17b2fe6eeeebf5
Author: Miro Hrončok <miro at hroncok.cz>
Date:   Wed Jun 5 14:40:24 2013 +0200

    Added tests

 .gitignore                |    1 +
 python-django-piston.spec |   30 +++++++++++++++++++++++++++---
 sources                   |    1 +
 3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e3e727b..3350a63 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 /django-piston-0.2.3.tar.gz
+/python-django-piston-testapp.tar.bz2
diff --git a/python-django-piston.spec b/python-django-piston.spec
index 34b6e3a..9adac6e 100644
--- a/python-django-piston.spec
+++ b/python-django-piston.spec
@@ -1,13 +1,14 @@
 %global pkgname django-piston
 Name:           python-django-piston
 Version:        0.2.3
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        A mini-framework for Django for creating RESTful APIs
 
 Group:          Development/Languages
 License:        BSD
 URL:            http://bitbucket.org/jespern/django-piston/
-Source:         http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
+Source0:        http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
+Source1:        %{name}-testapp.tar.bz2
 #md5=8b040d426793cf22ce89543e059cd6e1
 
 # https://bitbucket.org/jespern/django-piston/pull-request/25/compatibility-fix-for-json-emitter-with/diff
@@ -17,6 +18,9 @@ BuildArch:      noarch
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools 
 BuildRequires:  python-zc-buildout
+# for test
+BuildRequires:  python-django
+BuildRequires:  procps-ng
 
 Requires:       python-django
 
@@ -32,6 +36,8 @@ create application programming interfaces (API) for your sites.
 %patch0 -p1
 rm -rf django_piston.egg-info
 
+%setup -q -T -D -a 1 -n %{pkgname}-%{version}
+
 %build
 %{__python} setup.py build
 
@@ -39,6 +45,20 @@ rm -rf django_piston.egg-info
 %install
 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 
+%check
+cd %{name}-testapp
+PYTHONPATH=.. %{__python} manage.py runserver &
+sleep 2
+test `curl -s http://localhost:8000/api/calc/8/2` -eq 4
+test `curl -s http://localhost:8000/api/calc/8+2` -eq 10
+test `curl -s http://localhost:8000/api/calc/8*2` -eq 16
+
+# kill the server and all it's forks
+for PID in `ps aux | grep 'manage.py runserver' | grep -v grep | awk '{print $2}'`; do
+  kill $PID
+done
+
+cd -
 
 %files
 %defattr(-,root,root,-)
@@ -48,6 +68,10 @@ rm -rf django_piston.egg-info
 %{python_sitelib}/django_piston-%{version}-py2.?-nspkg.pth
 
 %changelog
+* Wed Jun 05 2013 Miro Hrončok <mhroncok at redhat.com> - 0.2.3-7
+- Added test
+- Fixed bogus date in %%changelog
+
 * Wed Jun 05 2013 Miro Hrončok <mhroncok at redhat.com> - 0.2.3-6
 - Changed Requires Django to python-django
 - Added Django 1.5 compatibility patch
@@ -75,5 +99,5 @@ rm -rf django_piston.egg-info
 * Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 0.2.2-2
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 
-* Thu Aug 14 2009 Diego Búrigo Zacarão <diegobz at gmail.com> 0.2.2-1
+* Fri Aug 14 2009 Diego Búrigo Zacarão <diegobz at gmail.com> 0.2.2-1
 - Initial RPM release
diff --git a/sources b/sources
index 405540b..bdc34f9 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
 8b040d426793cf22ce89543e059cd6e1  django-piston-0.2.3.tar.gz
+34a451788c8c76f149fb13999e86bbd6  python-django-piston-testapp.tar.bz2


More information about the scm-commits mailing list