@@ -49,13 +49,21 @@ def test_localhost(self):
49
49
self .assertEqual (settings_dict ["NAME" ], "myDatabase" )
50
50
self .assertEqual (settings_dict ["HOST" ], "localhost" )
51
51
52
+ def test_localhost_with_port (self ):
53
+ settings_dict = parse_uri ("mongodb://localhost/myDatabase" )
54
+ self .assertEqual (settings_dict ["ENGINE" ], "django_mongodb" )
55
+ self .assertEqual (settings_dict ["NAME" ], "myDatabase" )
56
+ self .assertEqual (settings_dict ["HOST" ], "localhost" )
57
+ self .assertEqual (settings_dict ["PORT" ], 27017 )
58
+
52
59
def test_localhosts_with_ports (self ):
53
60
settings_dict = parse_uri (
54
61
"mongodb://localhost:27017,localhost:27018,localhost:27019/myDatabase"
55
62
)
56
63
self .assertEqual (settings_dict ["ENGINE" ], "django_mongodb" )
57
64
self .assertEqual (settings_dict ["NAME" ], "myDatabase" )
58
65
self .assertEqual (settings_dict ["HOST" ], "localhost:27017,localhost:27018,localhost:27019" )
66
+ self .assertEqual (settings_dict ["PORT" ], None )
59
67
60
68
@patch ("dns.resolver.resolve" )
61
69
def test_conn_max_age (self , mock_resolver ):
0 commit comments