Skip to content

Commit 5ebf6a2

Browse files
committed
more tests
1 parent b14ace4 commit 5ebf6a2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/utils_/test_parse.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ def test_srv_uri_with_options(self, mock_resolver):
4040
settings_dict["OPTIONS"], {"retryWrites": True, "w": "majority", "tls": False}
4141
)
4242

43+
def test_localhost(self):
44+
settings_dict = django_mongodb.parse("mongodb://localhost/myDatabase")
45+
self.assertEqual(settings_dict["ENGINE"], "django_mongodb")
46+
self.assertEqual(settings_dict["NAME"], "myDatabase")
47+
self.assertEqual(settings_dict["HOST"], "localhost")
48+
49+
def test_localhost_bad_credentials(self):
50+
with self.assertRaises(pymongo.errors.InvalidURI):
51+
django_mongodb.parse("mongodb://:@localhost/myDatabase")
52+
4353
@patch("dns.resolver.resolve")
4454
def test_engine_kwarg(self, mock_resolver):
4555
settings_dict = django_mongodb.parse(URI, engine="some_other_engine")

0 commit comments

Comments
 (0)