Permalink
Browse files

test environment variables

  • Loading branch information...
1 parent 4359972 commit 1c33ee47cf628155bd77ba9c5d08cc3c4926708c @kennethreitz committed Jun 19, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 test_dj_database_url.py
View
@@ -48,6 +48,23 @@ def test_cleardb_parsing(self):
assert url['PASSWORD'] == '69772142'
assert url['PORT'] is None
+ def test_database_url(self):
+ a = dj_database_url.config()
+ assert not a
+
+ os.environ['DATABASE_URL'] = 'postgres://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn'
+
+ url = dj_database_url.config()
+
+ assert url['ENGINE'] == 'django.db.backends.postgresql_psycopg2'
+ 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
+
+
+
if __name__ == '__main__':
unittest.main()

0 comments on commit 1c33ee4

Please sign in to comment.