diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2012-11-30 14:27:46 +0100 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2012-11-30 14:27:46 +0100 |
commit | 716fee916da1096edb865bb43224594574d5a85b (patch) | |
tree | 96a48d79819c42843259ceaacdfd0405a6c7be4d | |
parent | 7bdb024a3245df9c5bd7148d749197449f674442 (diff) | |
download | hyperkitty-716fee916da1096edb865bb43224594574d5a85b.tar.gz hyperkitty-716fee916da1096edb865bb43224594574d5a85b.tar.xz hyperkitty-716fee916da1096edb865bb43224594574d5a85b.zip |
Add spec file and fix unit tests
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | hyperkitty.spec | 64 | ||||
-rw-r--r-- | hyperkitty/api.py | 2 | ||||
-rw-r--r-- | hyperkitty/tests/test_views.py | 4 | ||||
-rw-r--r-- | hyperkitty/tests_conf/__init__.py | 0 | ||||
-rw-r--r-- | hyperkitty/tests_conf/settings_tests.py | 48 | ||||
-rw-r--r-- | hyperkitty/tests_conf/urls_test.py | 11 | ||||
-rw-r--r-- | requirements.txt | 8 |
8 files changed, 132 insertions, 8 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 1ccb6ce..6cbfc7a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ -include AUTHORS.txt COPYING.txt pylintrc distribute_setup.py requirements.txt +include AUTHORS.txt COPYING.txt pylintrc distribute_setup.py requirements.txt hyperkitty.spec # http://bruno.im/2010/may/05/packaging-django-reusable-app/ recursive-include hyperkitty *.py *.html *.js graft hyperkitty/static +graft hyperkitty/fixtures include doc/conf.py doc/Makefile doc/*.rst diff --git a/hyperkitty.spec b/hyperkitty.spec new file mode 100644 index 0000000..53b151e --- /dev/null +++ b/hyperkitty.spec @@ -0,0 +1,64 @@ +%global pypi_name HyperKitty + +Name: hyperkitty +Version: 0.1.3 +Release: 1%{?dist} +Summary: A web interface to access GNU Mailman v3 archives + +License: GPLv3 +URL: https://fedorahosted.org/hyperkitty/ +Source0: http://pypi.python.org/packages/source/H/%{pypi_name}/%{pypi_name}-%{version}.tar.gz +BuildArch: noarch + +BuildRequires: python-devel +BuildRequires: python-sphinx +# Unit tests in %%check +BuildRequires: Django +BuildRequires: kittystore +BuildRequires: django-rest-framework >= 0.3.3 +BuildRequires: django-social-auth >= 0.7.0 + +Requires: Django >= 1.4 +Requires: django-gravatar >= 0.1.0 +Requires: django-social-auth >= 0.7.0 +Requires: django-rest-framework >= 0.3.3 +Requires: mailman >= 3.0.0b2 +Requires: kittystore + + +%description +HyperKitty is an open source Django application under development. It aims at providing a web interface to access GNU Mailman archives. +The code is available from: http://bzr.fedorahosted.org/bzr/hyperkitty/. +The documentation can be browsed online at https://hyperkitty.readthedocs.org/. + +%prep +%setup -q -n %{pypi_name}-%{version} +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info + +# generate html docs +sphinx-build doc html +# remove the sphinx-build leftovers +rm -rf html/.{doctrees,buildinfo} + +%build +%{__python} setup.py build + + +%install +%{__python} setup.py install --skip-build --root %{buildroot} + + +%check +%{__python} %{_bindir}/django-admin test --pythonpath=`pwd` --settings=hyperkitty.tests_conf.settings_tests hyperkitty + + +%files +%doc html README.rst COPYING.txt +%{python_sitelib}/%{name} +%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info + + +%changelog +* Thu Nov 29 2012 Aurelien Bompard - 0.1.3-1 +- Initial package. diff --git a/hyperkitty/api.py b/hyperkitty/api.py index 1fc8212..a75dc4a 100644 --- a/hyperkitty/api.py +++ b/hyperkitty/api.py @@ -20,7 +20,7 @@ import json import re -from djangorestframework.views import View +from rest_framework.views import View from django.conf.urls.defaults import url from django.conf import settings from django.http import HttpResponseNotModified, HttpResponse diff --git a/hyperkitty/tests/test_views.py b/hyperkitty/tests/test_views.py index 8f540c6..dd85258 100644 --- a/hyperkitty/tests/test_views.py +++ b/hyperkitty/tests/test_views.py @@ -74,11 +74,11 @@ class MessageViewsTestCase(TestCase): User.objects.create_user('testuser', 'syst3m.w0rm+test@gmail.com', 'testPass') user = self.client.login(username='testuser', password='testPass') - resp = self.client.post(reverse('message_vote', kwargs={'mlist_fqdn': 'list@list.com'}), {'vote': 1, 'messageid': 123, }) + resp = self.client.post(reverse('message_vote', kwargs={'mlist_fqdn': 'list@list.com'}), {'vote': 1, 'hashid': 123, }) self.assertEqual(resp.status_code, 200) def test_unauth_vote(self): - resp = self.client.post(reverse('message_vote', kwargs={'mlist_fqdn': 'list@list.com'}), {'vote': 1, 'messageid': 123, }) + resp = self.client.post(reverse('message_vote', kwargs={'mlist_fqdn': 'list@list.com'}), {'vote': 1, 'hashid': 123, }) url = "%s?next=%s" % (reverse('user_login'), urllib.quote(reverse('message_vote', kwargs={'mlist_fqdn': 'list@list.com'}))) self.assertRedirects(resp, url) diff --git a/hyperkitty/tests_conf/__init__.py b/hyperkitty/tests_conf/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hyperkitty/tests_conf/__init__.py diff --git a/hyperkitty/tests_conf/settings_tests.py b/hyperkitty/tests_conf/settings_tests.py new file mode 100644 index 0000000..8b6195e --- /dev/null +++ b/hyperkitty/tests_conf/settings_tests.py @@ -0,0 +1,48 @@ +# +# WARNING: this module is only used to run the unit tests. Do not use it to run +# HyperKitty, use the hyperkitty_standalone module instead (please see the +# HyperKitty docs to find it). +# + +import os +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +MAILMAN_API_URL=r'http://%(username)s:%(password)s@localhost:8001/3.0/' +MAILMAN_USER='mailmanapi' +MAILMAN_PASS='mailmanpass' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': ':memory:', + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', +# 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', +# 'django.contrib.messages.middleware.MessageMiddleware', + 'hyperkitty.lib.store.KittyStoreDjangoMiddleware', +) + +ROOT_URLCONF = 'hyperkitty.tests_conf.urls_test' + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'hyperkitty', +) + +LOGIN_URL = '/hyperkitty/accounts/login/' +KITTYSTORE_URL = 'sqlite:' +KITTYSTORE_DEBUG=False +USE_MOCKUPS = False diff --git a/hyperkitty/tests_conf/urls_test.py b/hyperkitty/tests_conf/urls_test.py new file mode 100644 index 0000000..c4cd3a0 --- /dev/null +++ b/hyperkitty/tests_conf/urls_test.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +import hyperkitty + +from django.conf.urls.defaults import * + +urlpatterns = patterns('', + #url(r'^$', 'hyperkitty.views.pages.index'), + (r'^hyperkitty/', include('hyperkitty.urls')), + #url(r'', include('social_auth.urls')), +) diff --git a/requirements.txt b/requirements.txt index e00163e..b6f9c4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -Django==1.4 -django-gravatar==0.1.0 -django-social-auth==0.7.0 -djangorestframework==0.3.3 +Django>=1.4 +django-gravatar>=0.1.0 +django-social-auth>=0.7.0 +djangorestframework>=0.3.3 mailman>=3.0.0b2 kittystore |