Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit 69cb78b

Browse files
author
pierreben
committed
MAINT: Configure test environment
1 parent c8152d1 commit 69cb78b

File tree

13 files changed

+128
-5
lines changed

13 files changed

+128
-5
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ matrix:
1414
exclude:
1515
- python: "3.5"
1616
env: DJANGO="django>=1.7,<1.8"
17+
- python: "3.3"
18+
env: DJANGO="django>=1.9,<1.10"
1719
install:
1820
- "pip install $DJANGO"
1921
script:

README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ django-cross-site-urls
1818
:target: https://coveralls.io/r/kapt-labs/django-cross-site-urls
1919
:alt: Coveralls status
2020

21-
*A Django module allowing to resolve urls across two django sites.*
21+
22+
Please consider that this module is in active development and is currently not ready for production.
23+
24+
*A Django module allowing to resolve urls across two django different sites.*
2225

2326
.. contents:: :local:
2427

2528
Requirements
2629
------------
2730

28-
Python 2.7+ or 3.3+, Django 1.7+, Django REST framework >= 3.2.4.
31+
Python 2.7+ or 3.3+, Django 1.7+, Django REST framework 3.2+, Slumber 0.7+.
2932

3033
Installation
3134
-------------
@@ -42,6 +45,7 @@ Once installed you just need to add ``cross_site_urls`` to ``INSTALLED_APPS`` in
4245

4346
INSTALLED_APPS = (
4447
# other apps
48+
'rest_framework',
4549
'cross_site_urls',
4650
)
4751

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pytest-django>=2.9
55
pytest-spec>=0.2
66
pytest-pythonpath
77
coverage>=4
8-
coveralls>1.1
8+
coveralls>1.0
99
tox>=1.7
1010
flake8>2.5
1111

tests/__init__.py

Whitespace-only changes.

tests/_testsite/__init__.py

Whitespace-only changes.

tests/_testsite/templates/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void

tests/_testsite/templates/simple.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void

tests/_testsite/urls.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from __future__ import unicode_literals
4+
5+
from django.conf.urls import include
6+
from django.conf.urls.i18n import i18n_patterns
7+
from django.conf.urls import url
8+
from django.contrib import admin
9+
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
10+
11+
# Local application / specific library imports
12+
from cross_site_urls.conf import settings as cross_site_settings
13+
14+
admin.autodiscover()
15+
16+
urlpatterns = i18n_patterns(
17+
'',
18+
url((r'^{}').format(cross_site_settings.DEFAULT_API_URL), include('cross_site_urls.urls')),
19+
)
20+
21+
urlpatterns += staticfiles_urlpatterns()

tests/settings.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Standard library imports
4+
import os
5+
6+
TEST_ROOT = os.path.abspath(os.path.dirname(__file__))
7+
8+
9+
class DisableMigrations(object):
10+
def __contains__(self, item):
11+
return True
12+
13+
def __getitem__(self, item):
14+
return 'notmigrations'
15+
16+
17+
DEBUG = False
18+
TEMPLATE_DEBUG = False
19+
20+
SECRET_KEY = 'key'
21+
22+
DATABASES = {
23+
'default': {
24+
'ENGINE': 'django.db.backends.sqlite3',
25+
'NAME': ':memory:'
26+
},
27+
}
28+
29+
INSTALLED_APPS = [
30+
'django.contrib.auth',
31+
'django.contrib.contenttypes',
32+
'django.contrib.messages',
33+
'django.contrib.staticfiles',
34+
'django.contrib.sessions',
35+
'django.contrib.sites',
36+
37+
'rest_framework',
38+
'cross_site_urls',
39+
'tests',
40+
]
41+
42+
MIGRATION_MODULES = DisableMigrations()
43+
TEST_RUNNER = 'django.test.runner.DiscoverRunner' # Hide checks
44+
45+
MIDDLEWARE_CLASSES = (
46+
'django.contrib.sessions.middleware.SessionMiddleware',
47+
'django.middleware.csrf.CsrfViewMiddleware',
48+
'django.contrib.auth.middleware.AuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.locale.LocaleMiddleware',
51+
'django.middleware.common.CommonMiddleware',
52+
)
53+
54+
MEDIA_ROOT = '/media/'
55+
STATIC_URL = '/static/'
56+
57+
USE_TZ = True
58+
LANGUAGE_CODE = 'en'
59+
LANGUAGES = (
60+
('fr', 'Français'),
61+
('en', 'English'),
62+
)
63+
64+
SITE_ID = 1
65+
66+
ROOT_URLCONF = 'tests._testsite.urls'
67+
68+
# Setting this explicitly prevents Django 1.7+ from showing a
69+
# warning regarding a changed default test runner. The test
70+
# suite is run with py.test, so it does not matter.
71+
SILENCED_SYSTEM_CHECKS = ['1_6.W001']

tests/unit/__init__.py

Whitespace-only changes.

tests/unit/test_utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# -*- coding:utf-8 -*-
2+
3+
from __future__ import unicode_literals
4+
5+
from cross_site_urls.utils import get_api_url
6+
7+
8+
class TestGetAPIUrlUtils(object):
9+
def test_can_retrieve_api_url(self):
10+
url = get_api_url('http', 'example.com')
11+
assert url == 'http://example.com/en/urls/'

tests/unit/test_utils.py~

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- coding:utf-8 -*-
2+
3+
from __future__ import unicode_literals
4+
5+
import pytest
6+
7+
from cross_site_urls.utils import get_api_url
8+
9+
class TestGetAPIUrlUtils(object):
10+
def can_retrieve_api_url(self):
11+
url = get_api_url('http', 'example.com')
12+
assert url == 'http://example.com/en/urls/'

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tox]
22
envlist=
33
py27-django{17,18,19},
4-
py33-django{17,18,19},
4+
py33-django{17,18},
55
py34-django{17,18,19},
66
py35-django{18,19},
77
lint
88

99
[flake8]
1010
ignore = E501
11-
exclude = migrations,south_migrations,example_project,build,docs,.tox,.venv
11+
exclude = build,docs,.tox,.venv
1212

1313
[testenv]
1414
deps =

0 commit comments

Comments
 (0)