diff --git a/.travis.yml b/.travis.yml index 71eb5d9..0c424b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ env: install: - "pip install -r requirements.txt" - "pip install Django==$DJANGO_VERSION" -script: "python src/manage.py test testapp" +script: "python src/auditlog_tests/runtests.py" diff --git a/README.md b/README.md index e9b0b3e..45d0089 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ django-auditlog =============== +[![Build Status](https://travis-ci.org/jjkester/django-auditlog.svg?branch=master)](https://travis-ci.org/jjkester/django-auditlog) + **Please remember that this app is still in development and not yet suitable for production environments.** ```django-auditlog``` (Auditlog) is a reusable app for Django that makes logging object changes a breeze. Auditlog tries to use as much as Python and Django’s built in functionality to keep the list of dependencies as short as possible. Also, Auditlog aims to be fast and simple to use. diff --git a/src/test_project/__init__.py b/src/auditlog_tests/__init__.py similarity index 100% rename from src/test_project/__init__.py rename to src/auditlog_tests/__init__.py diff --git a/src/testapp/models.py b/src/auditlog_tests/models.py similarity index 100% rename from src/testapp/models.py rename to src/auditlog_tests/models.py diff --git a/src/auditlog_tests/runtests.py b/src/auditlog_tests/runtests.py new file mode 100644 index 0000000..b7df405 --- /dev/null +++ b/src/auditlog_tests/runtests.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +import django +from django.conf import settings +from django.test.utils import get_runner + +if __name__ == "__main__": + os.environ['DJANGO_SETTINGS_MODULE'] = 'auditlog_tests.test_settings' + django.setup() + TestRunner = get_runner(settings) + test_runner = TestRunner() + failures = test_runner.run_tests(["auditlog_tests"]) + sys.exit(bool(failures)) diff --git a/src/auditlog_tests/test_settings.py b/src/auditlog_tests/test_settings.py new file mode 100644 index 0000000..84ca8f6 --- /dev/null +++ b/src/auditlog_tests/test_settings.py @@ -0,0 +1,24 @@ +""" +Settings file for the Auditlog test suite. +""" + +SECRET_KEY = 'test' + +INSTALLED_APPS = [ + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'auditlog', + 'auditlog_tests', +] + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'auditlog.middleware.AuditlogMiddleware', +) + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'auditlog_test', + } +} diff --git a/src/testapp/tests.py b/src/auditlog_tests/tests.py similarity index 98% rename from src/testapp/tests.py rename to src/auditlog_tests/tests.py index 80e36dd..cd93bd3 100644 --- a/src/testapp/tests.py +++ b/src/auditlog_tests/tests.py @@ -6,7 +6,7 @@ from django.http import HttpResponse from django.test import TestCase, RequestFactory from auditlog.middleware import AuditlogMiddleware from auditlog.models import LogEntry -from testapp.models import SimpleModel, AltPrimaryKeyModel, ProxyModel, \ +from auditlog_tests.models import SimpleModel, AltPrimaryKeyModel, ProxyModel, \ SimpleIncludeModel, SimpleExcludeModel diff --git a/src/manage.py b/src/manage.py deleted file mode 100644 index 0fc36a3..0000000 --- a/src/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/src/test_project/settings.py b/src/test_project/settings.py deleted file mode 100644 index 9666e46..0000000 --- a/src/test_project/settings.py +++ /dev/null @@ -1,68 +0,0 @@ -# Django settings for test_project project. -import os - -BASEDIR = os.path.dirname(os.path.realpath(__file__)) - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASEDIR, 'test.db'), - } -} - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'j6qdljfn(m$w-4r5*wx_m!!o4-z0ehe09y%k8s@kf)zmyc366*' - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.app_directories.Loader', -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'auditlog.middleware.AuditlogMiddleware', -) - -ROOT_URLCONF = 'test_project.urls' - -# Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = 'test_project.wsgi.application' - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'auditlog', - 'testapp', -) - -# A sample logging configuration. The only tangible logging -# performed by this configuration is to send an email to -# the site admins on every HTTP 500 error when DEBUG=False. -# See http://docs.djangoproject.com/en/dev/topics/logging for -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} diff --git a/src/test_project/urls.py b/src/test_project/urls.py deleted file mode 100644 index cc4356b..0000000 --- a/src/test_project/urls.py +++ /dev/null @@ -1,17 +0,0 @@ -from django.conf.urls import patterns, include, url - -# Uncomment the next two lines to enable the admin: -# from django.contrib import admin -# admin.autodiscover() - -urlpatterns = patterns('', - # Examples: - # url(r'^$', 'test_project.views.home', name='home'), - # url(r'^test_project/', include('test_project.foo.urls')), - - # Uncomment the admin/doc line below to enable admin documentation: - # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - # url(r'^admin/', include(admin.site.urls)), -) diff --git a/src/test_project/wsgi.py b/src/test_project/wsgi.py deleted file mode 100644 index 43ff066..0000000 --- a/src/test_project/wsgi.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -WSGI config for test_project project. - -This module contains the WSGI application used by Django's development server -and any production WSGI deployments. It should expose a module-level variable -named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover -this application via the ``WSGI_APPLICATION`` setting. - -Usually you will have the standard Django WSGI application here, but it also -might make sense to replace the whole Django WSGI application with a custom one -that later delegates to the Django one. For example, you could introduce WSGI -middleware here, or combine a Django application with an application of another -framework. - -""" -import os - -# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks -# if running multiple sites in the same mod_wsgi process. To fix this, use -# mod_wsgi daemon mode with each site in its own daemon process, or use -# os.environ["DJANGO_SETTINGS_MODULE"] = "test_project.settings" -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") - -# This application object is used by any WSGI server configured to use this -# file. This includes Django's development server, if the WSGI_APPLICATION -# setting points here. -from django.core.wsgi import get_wsgi_application -application = get_wsgi_application() - -# Apply WSGI middleware here. -# from helloworld.wsgi import HelloWorldApplication -# application = HelloWorldApplication(application) diff --git a/src/testapp/__init__.py b/src/testapp/__init__.py deleted file mode 100644 index e69de29..0000000