Skip to content

Commit

Permalink
Test revision with Google Cloud SQL connector
Browse files Browse the repository at this point in the history
Add synthetic test correlating to Google Cloud SQL connector socket, to make sure Issue jazzband#132 is solved.
  • Loading branch information
jared-hardy authored Oct 6, 2021
1 parent 99127da commit b9d905d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test_dj_database_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ def test_postgres_unix_socket_parsing(self):
assert url['PASSWORD'] == ''
assert url['PORT'] == ''

def test_postgres_google_cloud_parsing(self):
url = 'postgres://uf07k1i6d8ia0v:wegauwhgeuioweg@%2Fcloudsql%2Fproject_id%3Aregion%3Ainstance_id:5431/d8r82722r2kuvn'
url = dj_database_url.parse(url)

assert url['ENGINE'] == EXPECTED_POSTGRES_ENGINE
assert url['NAME'] == 'd8r82722r2kuvn'
assert url['HOST'] == '/cloudsql/project_id:region:instance_id'
assert url['USER'] == 'uf07k1i6d8ia0v'
assert url['PASSWORD'] == 'wegauwhgeuioweg'
assert url['PORT'] == 5431

def test_ipv6_parsing(self):
url = 'postgres://ieRaekei9wilaim7:wegauwhgeuioweg@[2001:db8:1234::1234:5678:90af]:5431/d8r82722r2kuvn'
url = dj_database_url.parse(url)
Expand Down

0 comments on commit b9d905d

Please sign in to comment.