Browse Source

Add test case for explicit sslmode enabling

pull/189/head
Clemens Wolff 5 years ago
parent
commit
756fff84fa
1 changed files with 5 additions and 1 deletions
  1. 6
      app/server/tests/test_config.py

6
app/server/tests/test_config.py

@ -16,10 +16,14 @@ class TestDatabaseUrl(TestCase):
with setenv('DATABASE_URL', 'sqlite:///some/path'):
self._assert_sslmode_is(None)
def test_sslmode_can_be_set_via_database_url(self):
def test_sslmode_can_be_disabled_via_database_url(self):
with setenv('DATABASE_URL', 'pgsql://u:p@h/d?sslmode=disabled'):
self._assert_sslmode_is('disabled')
def test_sslmode_can_be_required_via_database_url(self):
with setenv('DATABASE_URL', 'pgsql://u:p@h/d?sslmode=require'):
self._assert_sslmode_is('require')
def _assert_sslmode_is(self, expected):
reload(settings)
actual = settings.DATABASES['default'].get('OPTIONS', {}).get('sslmode')

Loading…
Cancel
Save