Anonymous avatar Anonymous committed f5b6f73

Created initial test

Comments (0)

Files changed (14)

 *.cache
 .svn*
 .git*
+.idea*
 *.egg-info
 Thumbs.db
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testsite.settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)

tests/templates/base.html

+<html>
+
+<head>
+</head>
+
+<body>
+    {% block content %}
+    {% endblock %}
+</body>
+
+</html>

tests/templates/home.html

+{% extends "base.html" %}
Add a comment to this file

tests/testapp/__init__.py

Empty file added.

tests/testapp/forms.py

+from django import forms
+from form_extensions.fields import USCurrencyField
+
+
+class USCurrencyForm(forms.Form):
+    price = USCurrencyField()

tests/testapp/models.py

+from django.db import models
+
+# Create your models here.

tests/testapp/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+from .forms import USCurrencyForm
+
+
+class USCurrencyFieldTests(TestCase):
+    def test_1(self):
+        data = {
+            'price': 'cat',
+        }
+        form = USCurrencyForm(data)
+        self.assertTrue(form.is_valid())

tests/testapp/views.py

+# Create your views here.
Add a comment to this file

tests/testsite/__init__.py

Empty file added.

tests/testsite/settings.py

+# Django settings for testsite project.
+import os
+DIRNAME = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2])
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+    ('Testing Testerson', 'test@example.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': 'django-accounts.db',
+    }
+}
+
+TIME_ZONE = 'America/Chicago'
+LANGUAGE_CODE = 'en-us'
+
+SITE_ID = 1
+
+USE_I18N = False
+USE_L10N = True
+USE_TZ = True
+
+MEDIA_ROOT = os.path.join(DIRNAME, 'media/')
+MEDIA_URL = '/media/'
+
+STATIC_ROOT = os.path.join(DIRNAME, 'files/')
+STATIC_URL = '/files/'
+
+STATICFILES_DIRS = (
+    os.path.join(DIRNAME, 'static/'),
+)
+
+STATICFILES_FINDERS = (
+    'django.contrib.staticfiles.finders.FileSystemFinder',
+    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+)
+
+SECRET_KEY = 'dkr+86m#8)$5b*y(c3n)jp5-kwr&amp;y+4a@tvi@rt2^h0e3%mnp^'
+
+TEMPLATE_LOADERS = (
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
+)
+
+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',
+)
+
+ROOT_URLCONF = 'testsite.urls'
+
+WSGI_APPLICATION = 'testsite.wsgi.application'
+
+TEMPLATE_DIRS = (
+    os.path.join(DIRNAME, 'templates/'),
+)
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'form_extensions',
+    'testapp',
+)
+
+
+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,
+        },
+    }
+}

tests/testsite/urls.py

+from django.conf.urls import patterns, include, url
+from .views import HomePageView
+
+# Uncomment the next two lines to enable the admin:
+# from django.contrib import admin
+# admin.autodiscover()
+
+urlpatterns = patterns('',
+    # Examples:
+    url(r'^$', HomePageView.as_view(), name='home'),
+    # url(r'^testsite/', include('testsite.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)),
+)

tests/testsite/views.py

+from django.views.generic.base import TemplateView
+
+class HomePageView(TemplateView):
+
+    template_name = "home.html"

tests/testsite/wsgi.py

+"""
+WSGI config for testsite 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", "testsite.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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.