コード例 #1
0
def mock_mongo():
    """Inject a MongoDB client connected to a mock server.

    No database in place, guaranteeing that we'll start from a clean slate.
    """
    client = get_client(mock=True)
    client.drop_database(os.getenv("MONGODB_DATABASE"))
    yield get_database(mock=True)
コード例 #2
0
def start_server(request):
    """Start the Graphql API server in a thread. This is done once per test session."""
    client = get_client(mock=True)
    thread = threading.Thread(target=start)
    thread.daemon = True
    thread.start()
    client.drop_database(os.getenv("DATABASE_NAME"))

    def start_server_fin():
        """Drop the MongoDB database as a cleanup measure."""
        client.drop_database(os.getenv("DATABASE_NAME"))
コード例 #3
0
def start_server(request, ):  # Input must exist due to 'fixture'. pylint:disable=unused-argument
    """Start the Graphql API server in a thread. This is done once per test session."""
    client = get_client(mock=True)
    thread = threading.Thread(target=start)
    thread.daemon = True
    thread.start()
    wait_for_webserver_connection()
    client.drop_database(os.getenv("MONGODB_DATABASE"))

    def start_server_fin():  # pylint:disable=unused-variable
        """Drop the MongoDB database as a cleanup measure."""
        client.drop_database(os.getenv("MONGODB_DATABASE"))
コード例 #4
0
def drop():
    """Drop the MongoDB database."""
    get_client(mock=True).drop_database(os.getenv("MONGO_DB"))