Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aclark4life committed Dec 2, 2024
1 parent e051f1e commit 8b4cf56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/utils_/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import django_mongodb

URI = "mongodb+srv://myDatabaseUser:D1fficultP%[email protected]/myDatabase?retryWrites=true&w=majority"
URI = "mongodb+srv://myDatabaseUser:D1fficultP%[email protected]/myDatabase?retryWrites=true&w=majority&tls=false"


class MongoParseURITests(SimpleTestCase):
Expand All @@ -20,14 +20,17 @@ def setUp(self):
self.addCleanup(self.patcher.stop)

@patch("dns.resolver.resolve")
def test_parse(self, mock_resolver):
def test_srv_uri_with_options(self, mock_resolver):
settings_dict = django_mongodb.parse(URI)
self.assertEqual(settings_dict["ENGINE"], "django_mongodb")
self.assertEqual(settings_dict["NAME"], "myDatabase")
self.assertEqual(settings_dict["HOST"], "mongodb+srv://cluster0.example.mongodb.net")
self.assertEqual(settings_dict["USER"], "myDatabaseUser")
self.assertEqual(settings_dict["PASSWORD"], "D1fficultP@ssw0rd")
self.assertEqual(settings_dict["PORT"], None)
self.assertEqual(
settings_dict["OPTIONS"], {"retryWrites": True, "w": "majority", "tls": False}
)

@patch("dns.resolver.resolve")
def test_engine_kwarg(self, mock_resolver):
Expand Down

0 comments on commit 8b4cf56

Please sign in to comment.