Skip to content

Commit 72fdfdd

Browse files
committed
test case where there is no URI
1 parent de35cc8 commit 72fdfdd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

flask_pymongo/tests/test_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def test_config_with_uri_passed_directly(self):
4646
assert mongo.db.name == self.dbname
4747
assert ("localhost", self.port) == mongo.cx.address
4848

49+
def test_it_fails_with_no_uri(self):
50+
self.app.config.pop("MONGO_URI", None)
51+
52+
with pytest.raises(ValueError):
53+
flask_pymongo.PyMongo(self.app)
54+
4955
def test_multiple_pymongos(self):
5056
uri1 = "mongodb://localhost:{}/{}".format(self.port, self.dbname)
5157
uri2 = "mongodb://localhost:{}/{}".format(self.port, self.dbname + "2")

0 commit comments

Comments
 (0)