Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 15d9236037cdc00bcad7d5e7dd1dd0a9921fc346 @mattrobenolt committed Jan 17, 2013
@@ -0,0 +1,34 @@
+*.py[cod]
+
+# C extensions
+*.so
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+lib
+lib64
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+nosetests.xml
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
@@ -0,0 +1,9 @@
+Copyright (c) 2013, Matt Robenolt
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
+include README.md
+include LICENSE
@@ -0,0 +1,11 @@
+clean:
+ rm -rf *.egg-info
+ rm -rf dist
+
+publish:
+ python setup.py sdist upload
+
+test:
+ cd tests; ./manage.py test
+
+.PHONY: clean publish test
No changes.
No changes.
No changes.
@@ -0,0 +1,8 @@
+from django.core.management.base import NoArgsCommand
+from django.core.management import call_command
+
+class Command(NoArgsCommand):
+ help = 'Run the proofread endpoint tests'
+
+ def handle_noargs(self, **options):
+ call_command('test', 'django_proofread.Endpoints')
@@ -0,0 +1 @@
+# Nothing to see here
@@ -0,0 +1,29 @@
+import unittest
+from django.conf import settings
+from django.test.client import Client
+
+ENDPOINTS = getattr(settings, 'PROOFREAD_ENDPOINTS', None)
+if ENDPOINTS is None:
+ import warnings
+ warnings.warn('settings.PROOFREAD_ENDPOINTS is missing')
+ ENDPOINTS = {}
+
+
+class BuildTestCase(type):
+ def __new__(cls, name, bases, attrs):
+ for endpoint, status_code in ENDPOINTS.items():
+ name = 'test_url_%s_%d' % (endpoint, status_code)
+ attrs[name] = (lambda endpoint, expected:
+ lambda self:
+ self.assertEqual(self.client.get(endpoint).status_code, expected)
+ )(endpoint, status_code)
+ attrs[name].__name__ = name
+ attrs[name].__doc__ = '`%s` should respond with a %d' % (endpoint, status_code)
+ return super(BuildTestCase, cls).__new__(cls, name, bases, attrs)
+
+
+class Endpoints(unittest.TestCase):
+ __metaclass__ = BuildTestCase
+
+ def setUp(self):
+ self.client = Client()
@@ -0,0 +1 @@
+# Nothing to see here
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+python manage.py proofread
@@ -0,0 +1 @@
+Django
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+"""
+django-proofread
+================
+
+"""
+from setuptools import setup, find_packages
+
+tests_require = map(lambda x: x.strip(), open('requirements.txt').readlines())
+
+setup(
+ name='django-proofread',
+ version='0.1.0',
+ author='Matt Robenolt',
+ author_email='matt@ydekproductions.com',
+ url='https://github.com/mattrobenolt/django-proofread',
+ description='Do some stuff',
+ long_description=__doc__,
+ license='BSD',
+ packages=find_packages(),
+ zip_safe=False,
+ tests_require=tests_require,
+ classifiers=[
+ 'Framework :: Django',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: System Administrators',
+ 'Operating System :: OS Independent',
+ 'Topic :: Software Development'
+ ],
+)
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)
No changes.
No changes.
@@ -0,0 +1,29 @@
+import sys
+import os.path
+
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3'
+ }
+}
+
+SECRET_KEY = 'lol'
+ROOT_URLCONF = 'tests.urls'
+WSGI_APPLICATION = 'tests.wsgi.application'
+
+INSTALLED_APPS = (
+ 'django_proofread',
+)
+
+TEMPLATE_DIRS = 'templates/',
+
+PROOFREAD_ENDPOINTS = {
+ '/': 200,
+ '/thisisawesome/': 200,
+ '/lolthisdoesntexist/': 404,
+}
@@ -0,0 +1,12 @@
+from django.conf.urls import patterns, url
+from django.http import HttpResponse
+
+
+def ok(request):
+ return HttpResponse()
+
+
+urlpatterns = patterns('',
+ url(r'^$', ok),
+ url(r'^thisisawesome/', ok)
+)
@@ -0,0 +1,28 @@
+"""
+WSGI config for tests 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
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.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)

0 comments on commit 15d9236

Please sign in to comment.