diff --git a/MANIFEST.in b/MANIFEST.in index dbabde1..15e9d9e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,5 +6,5 @@ graft src/postorius/static include src/postorius/doc/Makefile include dev-requirements.txt tox.ini -recursive-include testing *.py *.cfg +recursive-include example_project *.py *.cfg *.rst *.txt graft src/postorius/tests/fixtures diff --git a/example_project/README.rst b/example_project/README.rst index 0b4ee63..8c1576d 100644 --- a/example_project/README.rst +++ b/example_project/README.rst @@ -8,7 +8,7 @@ :: $ git clone https://gitlab.com/mailman/postorius.git - $ cd postorius/example + $ cd postorius/example_project $ virtualenv venv $ . venv/bin/activate $ pip install -r requirements.txt diff --git a/testing/__init__.py b/testing/__init__.py deleted file mode 100644 index 25c2b91..0000000 --- a/testing/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2012-2016 by the Free Software Foundation, Inc. -# -# This file is part of Postorius. -# -# Postorius is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# Postorius is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# Postorius. If not, see . - -import os -import vcr - -from django.conf import settings - - -TEST_DIR = os.path.abspath(os.path.dirname(__file__)) -FIXTURES_DIR = os.path.join(TEST_DIR, 'fixtures', 'vcr_cassettes') - - -MM_VCR = vcr.VCR(serializer='json', - cassette_library_dir=FIXTURES_DIR, - match_on=['uri', 'method']) diff --git a/testing/test_mailman.cfg b/testing/test_mailman.cfg deleted file mode 100644 index 64dcc1a..0000000 --- a/testing/test_mailman.cfg +++ /dev/null @@ -1,35 +0,0 @@ -# AUTOMATICALLY GENERATED BY MAILMAN ON 2015-01-18 07:49:14 -# -# This is your GNU Mailman 3 configuration file. You can edit this file to -# configure Mailman to your needs, and Mailman will never overwrite it. -# Additional configuration information is (for now) available in the -# schema.cfg file and the base mailman.cfg file -# . -# -# For example, uncomment the following lines to run Mailman in developer mode. -# -# [devmode] -# enabled: yes -# recipient: your.address@your.domain - -[devmode] -enabled: yes -testing: yes -recipient: you@yourdomain.com - -[mta] -smtp_port: 9025 -lmtp_port: 9024 -incoming: mailman.testing.mta.FakeMTA - -[webservice] -port: 9001 - -[archiver.mhonarc] -enable: yes - -[archiver.mail_archive] -enable: yes - -[archiver.prototype] -enable: yes diff --git a/testing/test_settings.py b/testing/test_settings.py deleted file mode 100755 index d425374..0000000 --- a/testing/test_settings.py +++ /dev/null @@ -1,155 +0,0 @@ -#-*- coding: utf-8 -*- -# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. -# -# This file is part of Postorius. -# -# Postorius is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# Postorius is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# Postorius. If not, see . - -""" -Django settings for postorius project. - -For more information on this file, see -https://docs.djangoproject.com/en/1.8/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.8/ref/settings/ -""" - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os - -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = ['localhost'] - - - -# Mailman API credentials for testing -MAILMAN_REST_API_URL = 'http://localhost:9001' -MAILMAN_REST_API_USER = 'restadmin' -MAILMAN_REST_API_PASS = 'restpass' - - -# Application definition - -INSTALLED_APPS = ( - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'postorius', - 'django_browserid', -) - -MIDDLEWARE_CLASSES = ( - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.middleware.locale.LocaleMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.security.SecurityMiddleware', - 'postorius.middleware.PostoriusMiddleware', -) - -# Set `postorius.urls` as main url config if Postorius -# is the only app you want to serve. -ROOT_URLCONF = 'testing.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.i18n', - 'django.template.context_processors.media', - 'django.template.context_processors.static', - 'django.template.context_processors.tz', - 'django.template.context_processors.csrf', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - 'postorius.context_processors.postorius', - ], - }, - }, -] - -#WSGI_APPLICATION = 'postorius_standalone.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'postorius.db'), - } -} - - -# Internationalization -# https://docs.djangoproject.com/en/1.8/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.8/howto/static-files/ - -STATIC_URL = '/static/' - - -LOGIN_URL = 'user_login' -LOGIN_REDIRECT_URL = 'list_index' -LOGOUT_URL = 'user_logout' - -def username(email): - return email.rsplit('@', 1)[0] -BROWSERID_USERNAME_ALGO = username - - -# Compatibility with Bootstrap 3 -from django.contrib.messages import constants as messages -MESSAGE_TAGS = { - messages.ERROR: 'danger' -} - - -AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'django_browserid.auth.BrowserIDBackend', -) diff --git a/testing/urls.py b/testing/urls.py deleted file mode 100644 index 2f81d0c..0000000 --- a/testing/urls.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. -# -# This file is part of Postorius. -# -# Postorius is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# Postorius is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# Postorius. If not, see . - -from django.conf.urls import include, url - -urlpatterns = [ - url('', include('django_browserid.urls')), - url(r'', include('postorius.urls')), -] diff --git a/tox.ini b/tox.ini index d94c6dd..b87cd2b 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ django19: Django>=1.9,<1.10a django-latest: https://github.com/django/django/archive/master.tar.gz commands = - coverage run {envbindir}/django-admin.py test --settings=testing.test_settings {posargs:postorius} + coverage run example_project/manage.py test {posargs:postorius} coverage report setenv = PYTHONPATH = {toxinidir} @@ -30,7 +30,7 @@ PYTHONPATH = {toxinidir} POSTORIUS_VCR_RECORD_MODE = all commands = - django-admin.py test --settings=testing.test_settings {posargs:postorius} + example_project/manage.py test {posargs:postorius} # These are used for local development and expect mailman.client to be @@ -46,7 +46,7 @@ commands = # Install mailmanclient from local repo instead of from pypi pip install -e ../mailmanclient - django-admin.py test --settings=testing.test_settings {posargs:postorius} + example_project/manage.py test {posargs:postorius} [testenv:dev-record] usedevelop = True @@ -60,7 +60,7 @@ commands = # Install mailmanclient from local repo instead of from pypi pip install -e ../mailmanclient - django-admin.py test --settings=testing.test_settings {posargs:postorius} + example_project/manage.py test {posargs:postorius} [testenv:pep8] basepython = python2.7 @@ -73,4 +73,4 @@ [flake8] ignore = E123, E133, E731 show-source = True -exclude = .git,.tox,dist,*egg,testing,src/postorius/doc,example +exclude = .git,.tox,dist,*egg,src/postorius/doc,example_project