commit
c854c98e49
7 changed files with 48 additions and 7 deletions
25
.travis.yml
Normal file
25
.travis.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
services:
|
||||
- postgresql
|
||||
env:
|
||||
- UMAP_SETTINGS=umap/tests/settings.py
|
||||
install:
|
||||
- pip install .
|
||||
- pip install -r requirements-dev.txt
|
||||
script: make test
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.freenode.net#umap"
|
||||
on_success: change
|
||||
on_failure: always
|
||||
email: false
|
||||
branches:
|
||||
only:
|
||||
- master
|
|
@ -2,7 +2,7 @@
|
|||
# uMap project
|
||||
|
||||
[![Requirements Status](https://requires.io/github/umap-project/umap/requirements.svg?branch=master)](https://requires.io/github/umap-project/umap/requirements/?branch=master)
|
||||
[![Join the chat at https://gitter.im/umap-project/umap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/umap-project/umap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Documentation Status](https://readthedocs.org/projects/umap-project/badge/?version=latest)](http://umap-project.readthedocs.io/en/latest/?badge=latest)
|
||||
[![Join the chat at https://gitter.im/umap-project/umap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/umap-project/umap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Documentation Status](https://readthedocs.org/projects/umap-project/badge/?version=latest)](http://umap-project.readthedocs.io/en/latest/?badge=latest)[![Build Status](https://travis-ci.org/umap-project/umap.svg?branch=master)](https://travis-ci.org/umap-project/umap)
|
||||
|
||||
## About
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE=umap.settings.local
|
||||
DJANGO_SETTINGS_MODULE=umap.settings
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
pytest
|
||||
pytest-django
|
||||
mkdocs
|
||||
pytest==3.0.7
|
||||
pytest-django==3.1.2
|
||||
mkdocs==0.16.3
|
||||
|
|
|
@ -168,6 +168,12 @@ MAP_SHORT_URL_NAME = "umap_short_url"
|
|||
UMAP_USE_UNACCENT = False
|
||||
UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa
|
||||
USER_MAPS_URL = 'user_maps'
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
||||
'NAME': 'umap',
|
||||
}
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# Third party app settings
|
||||
|
|
3
umap/tests/settings.py
Normal file
3
umap/tests/settings.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from umap.settings.base import * # pylint: disable=W0614,W0401
|
||||
|
||||
SECRET_KEY = 'justfortests'
|
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import mimetypes
|
||||
import re
|
||||
import socket
|
||||
|
||||
try:
|
||||
|
@ -30,6 +31,13 @@ from leaflet_storage.forms import DEFAULT_CENTER
|
|||
User = get_user_model()
|
||||
|
||||
|
||||
PRIVATE_IP = re.compile(r'((^127\.)|(^10\.)'
|
||||
r'|(^172\.1[6-9]\.)'
|
||||
r'|(^172\.2[0-9]\.)'
|
||||
r'|(^172\.3[0-1]\.)'
|
||||
r'|(^192\.168\.))')
|
||||
|
||||
|
||||
class PaginatorMixin(object):
|
||||
per_page = 5
|
||||
|
||||
|
@ -229,8 +237,7 @@ def validate_url(request):
|
|||
ipaddress = socket.gethostbyname(toproxy.hostname)
|
||||
except:
|
||||
raise AssertionError()
|
||||
assert not ipaddress.startswith('127.')
|
||||
assert not ipaddress.startswith('192.168.')
|
||||
assert not PRIVATE_IP.match(ipaddress)
|
||||
return url
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue