Skip to content

Commit

Permalink
Use mock mongo client
Browse files Browse the repository at this point in the history
Connect MongoEngine with mongomock to test connections from a
configuration.
  • Loading branch information
king-alexander committed Jul 6, 2023
1 parent 2f4793f commit 7197959
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Test the functionality of the util sub-module."""

# Third-Party Libraries
from mongoengine import connect
from mongomock import MongoClient
import mongomock
import pytest

# cisagov Libraries
Expand Down Expand Up @@ -34,8 +33,4 @@ def test_load_config_valid():

def test_connect_from_config_valid(valid_config):
"""Test that a valid configuration connects to appropriate connections."""
connections = valid_config["connections"]
for alias in connections.keys():
connect(
host=connections[alias]["uri"], mongo_client_class=MongoClient, alias=alias
)
util.connect_from_config(valid_config, mongomock.MongoClient)

0 comments on commit 7197959

Please sign in to comment.