From 5461a5357de6df1879a229fb2689aaab562d6f8d Mon Sep 17 00:00:00 2001 From: meeb Date: Sun, 4 Apr 2021 23:04:51 +1000 Subject: [PATCH] check dicts output of parse_database_connection_string() in tests, part of #72 --- tubesync/common/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tubesync/common/tests.py b/tubesync/common/tests.py index 720324c..af0c2ca 100644 --- a/tubesync/common/tests.py +++ b/tubesync/common/tests.py @@ -70,8 +70,30 @@ class DatabaseConnectionTestCase(TestCase): def test_parse_database_connection_string(self): database_dict = parse_database_connection_string( 'postgresql://tubesync:password@localhost:5432/tubesync') + self.assertEqual(database_dict, + { + 'DRIVER': 'postgresql', + 'ENGINE': 'django.db.backends.postgresql', + 'USER': 'tubesync', + 'PASSWORD': 'password', + 'HOST': 'localhost', + 'PORT': 5432, + 'NAME': 'tubesync', + } + ) database_dict = parse_database_connection_string( 'mysql://tubesync:password@localhost:3306/tubesync') + self.assertEqual(database_dict, + { + 'DRIVER': 'mysql', + 'ENGINE': 'django.db.backends.mysql', + 'USER': 'tubesync', + 'PASSWORD': 'password', + 'HOST': 'localhost', + 'PORT': 3306, + 'NAME': 'tubesync', + } + ) # Invalid driver with self.assertRaises(DatabaseConnectionError): parse_database_connection_string(