Skip to content

Commit

Permalink
Add initial test suite. #10
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Sep 25, 2022
1 parent 77230ea commit 973ec53
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

import unittest

if __name__ == "__main__":
unittest.main()
59 changes: 59 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-

import django

SECRET_KEY = "django-freeze"

ALLOWED_HOSTS = ["*"]

SITE_ID = 1

INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.messages",
"django.contrib.sessions",
"django.contrib.sites",
"freeze",
]

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",
]

if django.VERSION < (2, 0):
MIDDLEWARE_CLASSES = MIDDLEWARE

ROOT_URLCONF = "tests.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",
],
},
},
]

DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
},
}

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
20 changes: 20 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-

from django.test import TestCase


class MetadataTestCase(TestCase):
"""
This class describes a metadata test case.
"""

def test_metadata(self):
from freeze.metadata import (
__author__,
__copyright__,
__description__,
__email__,
__license__,
__title__,
__version__,
)
24 changes: 24 additions & 0 deletions tests/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-

import django

if django.VERSION < (2, 0):
from django.conf.urls import include, url as re_path
else:
from django.urls import include, re_path

from freeze.views import download_static_site, generate_static_site


urlpatterns = [
re_path(
r"^download-static-site/$",
download_static_site,
name="freeze_download_static_site",
),
re_path(
r"^generate-static-site/$",
generate_static_site,
name="freeze_generate_static_site",
),
]

0 comments on commit 973ec53

Please sign in to comment.