From 94e8a6d35b555dbbd1dbbef28e1ea1bf831eb8b2 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 29 Apr 2021 19:13:10 +0100 Subject: [PATCH] Django test --- .../simple_django/mysite/.vimspector.json | 16 +++ .../python/simple_django/mysite/db.sqlite3 | Bin 0 -> 131072 bytes .../simple_django/mysite/example/__init__.py | 0 .../simple_django/mysite/example/admin.py | 3 + .../simple_django/mysite/example/apps.py | 5 + .../mysite/example/migrations/__init__.py | 0 .../simple_django/mysite/example/models.py | 3 + .../simple_django/mysite/example/tests.py | 3 + .../simple_django/mysite/example/urls.py | 8 ++ .../simple_django/mysite/example/views.py | 7 + .../python/simple_django/mysite/manage.py | 22 ++++ .../simple_django/mysite/mysite/__init__.py | 0 .../simple_django/mysite/mysite/asgi.py | 16 +++ .../simple_django/mysite/mysite/settings.py | 120 ++++++++++++++++++ .../simple_django/mysite/mysite/urls.py | 22 ++++ .../simple_django/mysite/mysite/wsgi.py | 16 +++ .../simple_django/mysite/requirements.txt | 4 + 17 files changed, 245 insertions(+) create mode 100644 support/test/python/simple_django/mysite/.vimspector.json create mode 100644 support/test/python/simple_django/mysite/db.sqlite3 create mode 100644 support/test/python/simple_django/mysite/example/__init__.py create mode 100644 support/test/python/simple_django/mysite/example/admin.py create mode 100644 support/test/python/simple_django/mysite/example/apps.py create mode 100644 support/test/python/simple_django/mysite/example/migrations/__init__.py create mode 100644 support/test/python/simple_django/mysite/example/models.py create mode 100644 support/test/python/simple_django/mysite/example/tests.py create mode 100644 support/test/python/simple_django/mysite/example/urls.py create mode 100644 support/test/python/simple_django/mysite/example/views.py create mode 100755 support/test/python/simple_django/mysite/manage.py create mode 100644 support/test/python/simple_django/mysite/mysite/__init__.py create mode 100644 support/test/python/simple_django/mysite/mysite/asgi.py create mode 100644 support/test/python/simple_django/mysite/mysite/settings.py create mode 100644 support/test/python/simple_django/mysite/mysite/urls.py create mode 100644 support/test/python/simple_django/mysite/mysite/wsgi.py create mode 100644 support/test/python/simple_django/mysite/requirements.txt diff --git a/support/test/python/simple_django/mysite/.vimspector.json b/support/test/python/simple_django/mysite/.vimspector.json new file mode 100644 index 0000000..b5538f1 --- /dev/null +++ b/support/test/python/simple_django/mysite/.vimspector.json @@ -0,0 +1,16 @@ +{ + "$shema": "https://puremourning.github.com/vimspector/schema/vimspector.schema.json", + "configurations": { + "django": { + "adapter": "debugpy", + "configuration": { + "request": "launch", + "stopOnEntry": true, + "python": "${VIRTUAL_ENV}/bin/python3", + "program": "${workspaceRoot}/manage.py", + "args": [ "runserver", "localhost:5555", "--noreload" ], + "django": true + } + } + } +} diff --git a/support/test/python/simple_django/mysite/db.sqlite3 b/support/test/python/simple_django/mysite/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..5a1ceb95b5bfd7e5878d3de0991f06fdaaeca617 GIT binary patch literal 131072 zcmeI5eQX@*UB`F!)o;7wmpBue%Xz$xFWEXi@B4all%6lyOUyaW#c{Z^#A%q_9Xpd- z?>f8dyyzrgeYtCO1tf}E2_!g#gj587Kmk>#t%QmY0t79nhr~+}{B=;NEdsUuqnyO^ zJTtq`%|LMQ&pUdRL-@YLK3YPO;rzbtnU;09T8jC-oHj?|>^8KzvQ@9`?lg>Z zy=+`6jnA7>hiT41$lY(V&Qc;>a;q*X;i+t+Fd9r zpN%qMdO3Pdjxu>fPc+s#KNga<@WHJ-FGCU2HN7HvAx$vLekQb@Zg1} zTC5n)DSP_afs1JHzQvgnHiKASdTFI#?N6MB6f5aSWSvy#mR6Tnudd6hH&#~USJ#%W zEUj(GuM{@qr5o#4msg3)D}~i{B9%FDEwxs7xv*APy->Jrxv6=Nn0%4ut}#i=tIO-l zODiiIW@6!DS0n7!)a9MC=RO@FG$;DWwS&~LlQ5#LA zQrpt2QMs%(wWhwUS@ZRV(%2;pgErErT&&e9)?AuOy8!M#73c2FcQ?7qrd}tv>228- zvaf}Iy%W7z#>-DZ#_K z!^Z6j`CL;-MG<@QeM8U851d5jba-!dASC7U!h;;IU!yJY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Q6WvS(Dy-K%EboNS?GTF3NRI^TlXUwqdUoE}M z+hBLhXz1;w!C33;R7g_DUdwCNmeR59ewx$8lD4Q7ozhMoAkA7~bZc74^wV3SqeL|J z_Rl`cHVJ)d!P*i!Qk{xUxwe6h`QaJ>+5S(u&(x@ z7LDo78G>%JqHaay#2|ZU>iyy@h_Y+k#gT zX*FBSrjq<4gZXxbbHWVA<$J@`zSDp1bGL^HlswNiPbBh*V*euy6|kAOHd&00JNY0w4eaAOHd&00K`C0gV5jpvr(05C8!X009sH0T2KI z5C8!X009tqOaw6ge@tNE76d>51V8`;KmY_l00ck)1V8`;o*)7k|35*M0VyB=0w4ea zAOHd&00JNY0w4eaAn=$7gsI*009sH0T2KI5C8!X009sH0T2KI5I9l< z==lG{$j^Ahe-XbZep)Pw=f#o8zefHj^7%+TvKo0lG9Lb~@ZW}iKm1O3Jv=k=gOP8J z{NBg|QUE_700JNY0w4eaAOHd&00JQ3AP_wf@CdW>!8k*qMLq(BjQVY1_$@#BOFTsFurCXXLVNF?Wnu%;y43mHD?3 zoA-CLjxsY%rilv^#5nOnz?A1OHznE%j2i_^osI&gR%?OS7%4E92~fcfYbx4m`phUX zojT)Z%IROS>qw>-vPg1g=KQAAcD|{RSwsvAQ(N1@6h$vT7A6*_X8lx5JDaMY=g*Fi zyy=*a-JSgrxz6p`Rdkr-&(8bI`*$o%0fxsZ1|HS$zy zN`>;2)Bb>G@Jxb$!h}B%i6l%3IWpYa|vou9oElr6X%cwvs zXBVhIs~MHov9av`7afl-E~Q~&?~ literal 0 HcmV?d00001 diff --git a/support/test/python/simple_django/mysite/example/__init__.py b/support/test/python/simple_django/mysite/example/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/support/test/python/simple_django/mysite/example/admin.py b/support/test/python/simple_django/mysite/example/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/support/test/python/simple_django/mysite/example/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/support/test/python/simple_django/mysite/example/apps.py b/support/test/python/simple_django/mysite/example/apps.py new file mode 100644 index 0000000..e5e1012 --- /dev/null +++ b/support/test/python/simple_django/mysite/example/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PollsConfig(AppConfig): + name = 'example' diff --git a/support/test/python/simple_django/mysite/example/migrations/__init__.py b/support/test/python/simple_django/mysite/example/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/support/test/python/simple_django/mysite/example/models.py b/support/test/python/simple_django/mysite/example/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/support/test/python/simple_django/mysite/example/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/support/test/python/simple_django/mysite/example/tests.py b/support/test/python/simple_django/mysite/example/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/support/test/python/simple_django/mysite/example/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/support/test/python/simple_django/mysite/example/urls.py b/support/test/python/simple_django/mysite/example/urls.py new file mode 100644 index 0000000..05862a2 --- /dev/null +++ b/support/test/python/simple_django/mysite/example/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path( '', views.index, name='index' ) +] + diff --git a/support/test/python/simple_django/mysite/example/views.py b/support/test/python/simple_django/mysite/example/views.py new file mode 100644 index 0000000..77703e5 --- /dev/null +++ b/support/test/python/simple_django/mysite/example/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render +from django.http import HttpResponse + +# Create your views here. + +def index(request): + return HttpResponse( "Hello, world" ) diff --git a/support/test/python/simple_django/mysite/manage.py b/support/test/python/simple_django/mysite/manage.py new file mode 100755 index 0000000..a7da667 --- /dev/null +++ b/support/test/python/simple_django/mysite/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/support/test/python/simple_django/mysite/mysite/__init__.py b/support/test/python/simple_django/mysite/mysite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/support/test/python/simple_django/mysite/mysite/asgi.py b/support/test/python/simple_django/mysite/mysite/asgi.py new file mode 100644 index 0000000..451affb --- /dev/null +++ b/support/test/python/simple_django/mysite/mysite/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for mysite project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + +application = get_asgi_application() diff --git a/support/test/python/simple_django/mysite/mysite/settings.py b/support/test/python/simple_django/mysite/mysite/settings.py new file mode 100644 index 0000000..ee4b610 --- /dev/null +++ b/support/test/python/simple_django/mysite/mysite/settings.py @@ -0,0 +1,120 @@ +""" +Django settings for mysite project. + +Generated by 'django-admin startproject' using Django 3.1. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve(strict=True).parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '=a+s3wu_%ofwo63u6@&5-6_xn!j4i#m**7an_=85a-q(r&&448' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'mysite.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'mysite.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/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/3.1/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/support/test/python/simple_django/mysite/mysite/urls.py b/support/test/python/simple_django/mysite/mysite/urls.py new file mode 100644 index 0000000..81c2375 --- /dev/null +++ b/support/test/python/simple_django/mysite/mysite/urls.py @@ -0,0 +1,22 @@ +"""mysite URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import include, path + +urlpatterns = [ + path('polls/', include('example.urls')), + path('admin/', admin.site.urls), +] diff --git a/support/test/python/simple_django/mysite/mysite/wsgi.py b/support/test/python/simple_django/mysite/mysite/wsgi.py new file mode 100644 index 0000000..d04765f --- /dev/null +++ b/support/test/python/simple_django/mysite/mysite/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for mysite project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + +application = get_wsgi_application() diff --git a/support/test/python/simple_django/mysite/requirements.txt b/support/test/python/simple_django/mysite/requirements.txt new file mode 100644 index 0000000..f7da4a9 --- /dev/null +++ b/support/test/python/simple_django/mysite/requirements.txt @@ -0,0 +1,4 @@ +asgiref==3.3.4 +Django==3.2 +pytz==2021.1 +sqlparse==0.4.1