Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ help:
@echo " make test | Run the tests."

test:
@coverage run ./conman/tests/run.py
@python -Wmodule -m coverage run ./conman/tests/run.py
@coverage report --fail-under=100
@flake8

Expand Down
4 changes: 2 additions & 2 deletions conman/pages/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.test import TestCase
from incuna_test_utils.utils import field_names

from conman.routes.tests.test_models import NODE_BASE_FIELDS
from .. import models
Expand All @@ -11,8 +12,7 @@ def test_fields(self):
expected = (
'id',
'route_ptr',
'route_ptr_id',
'content',
) + NODE_BASE_FIELDS
fields = models.Page._meta.get_all_field_names()
fields = field_names(models.Page)
self.assertCountEqual(fields, expected)
5 changes: 2 additions & 3 deletions conman/redirects/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.core.exceptions import ValidationError
from django.forms import ModelForm
from django.test import TestCase
from incuna_test_utils.utils import field_names

from conman.routes.tests.test_models import NODE_BASE_FIELDS
from .factories import ChildRouteRedirectFactory
Expand All @@ -14,12 +15,10 @@ def test_fields(self):
expected = (
'id',
'route_ptr',
'route_ptr_id',
'target',
'target_id',
'permanent',
) + NODE_BASE_FIELDS
fields = RouteRedirect._meta.get_all_field_names()
fields = field_names(RouteRedirect)
self.assertCountEqual(fields, expected)

def test_target_self(self):
Expand Down
2 changes: 2 additions & 0 deletions conman/redirects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

class RouteRedirectView(RedirectView):
"""Redirect to the target Route."""
permanent = False # Set to django 1.9's default to avoid RemovedInDjango19Warning

def get_redirect_url(self, *args, **kwargs):
"""
Return the route's target url.
Expand Down
5 changes: 2 additions & 3 deletions conman/routes/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.db.utils import IntegrityError
from django.test import TestCase
from incuna_test_utils.utils import field_names

from .factories import ChildRouteFactory, RootRouteFactory, RouteFactory
from .. import handlers
Expand All @@ -10,7 +11,6 @@

NODE_BASE_FIELDS = (
'parent',
'parent_id',
'slug',
'url',

Expand All @@ -22,7 +22,6 @@

# Polymorphic fields
'polymorphic_ctype',
'polymorphic_ctype_id',

# Incoming foreign keys
'children', # FK from self. The other end of "parent".
Expand All @@ -42,7 +41,7 @@ def test_fields(self):
'routewithhandler',
'routewithouthandler',
) + NODE_BASE_FIELDS
fields = Route._meta.get_all_field_names()
fields = field_names(Route)
self.assertCountEqual(fields, expected)


Expand Down
4 changes: 3 additions & 1 deletion conman/routes/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.conf.urls import url

from .views import route_router


urlpatterns = [
# Capture urls that are at the root (^$) or end in a slash (^.+/$)
url(r'^(?P<url>|.+/)$', 'conman.routes.views.route_router'),
url(r'^(?P<url>|.+/)$', route_router),
]
8 changes: 6 additions & 2 deletions conman/tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@
'django.contrib.sessions',
'django.contrib.sites',
),
MIDDLEWARE_CLASSES=(),
PASSWORD_HASHERS=('django.contrib.auth.hashers.MD5PasswordHasher',),
SITE_ID=1,
ROOT_URLCONF='conman.tests.urls',
MIDDLEWARE_CLASSES=(),
SITE_ID=1,
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
}],
)


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-e .
colour-runner==0.0.4
coverage==3.7.1
coverage==4.0.3
dj-database-url==0.3
django==1.8.3
factory_boy==2.5.2
Expand Down
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[coverage:run]
source = conman
omit = *migrations*, *tests*

[coverage:report]
show_missing = True
skip_covered = True

[flake8]
max-line-length = 90
max-complexity = 10
Expand Down