mirror of
https://github.com/jazzband/dj-database-url.git
synced 2026-03-16 22:20:24 +00:00
added option of postgis backend to also add path parsing. (test added also)
This commit is contained in:
parent
f1b7985be1
commit
8a24aab17d
2 changed files with 13 additions and 0 deletions
|
|
@ -115,6 +115,7 @@ def parse(url, engine=None, conn_max_age=0):
|
|||
|
||||
# Support for Postgres Schema URLs
|
||||
if 'currentSchema' in options and engine in (
|
||||
'django.contrib.gis.db.backends.postgis',
|
||||
'django.db.backends.postgresql_psycopg2',
|
||||
'django_redshift_backend',
|
||||
):
|
||||
|
|
|
|||
|
|
@ -68,6 +68,18 @@ class DatabaseTestSuite(unittest.TestCase):
|
|||
assert url['PASSWORD'] == 'wegauwhgeuioweg'
|
||||
assert url['PORT'] == 5431
|
||||
|
||||
def test_postgis_search_path_parsing(self):
|
||||
url = 'postgis://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn?currentSchema=otherschema'
|
||||
url = dj_database_url.parse(url)
|
||||
assert url['ENGINE'] == 'django.contrib.gis.db.backends.postgis'
|
||||
assert url['NAME'] == 'd8r82722r2kuvn'
|
||||
assert url['HOST'] == 'ec2-107-21-253-135.compute-1.amazonaws.com'
|
||||
assert url['USER'] == 'uf07k1i6d8ia0v'
|
||||
assert url['PASSWORD'] == 'wegauwhgeuioweg'
|
||||
assert url['PORT'] == 5431
|
||||
assert url['OPTIONS']['options'] == '-c search_path=otherschema'
|
||||
assert 'currentSchema' not in url['OPTIONS']
|
||||
|
||||
def test_mysql_gis_parsing(self):
|
||||
url = 'mysqlgis://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn'
|
||||
url = dj_database_url.parse(url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue