# Path: src/franz/openrdf/tests/tests.py
# AG_HOST = os.environ.get('AGRAPH_HOST', LOCALHOST)
# 
# AG_PORT = int(os.environ.get('AGRAPH_PORT', '10035'))
# 
# AG_PROXY = os.environ.get('AGRAPH_PROXY')
# 
# STORE = 'agraph_test'
# 
# CATALOG = os.environ.get('AGRAPH_CATALOG', 'tests')
# 
# USER = os.environ.get('AGRAPH_USER', 'test')
# 
# PASSWORD = os.environ.get('AGRAPH_PASSWORD', 'xyzzy')


import random
import uuid
import pytest
import requests
import contextlib, os, threading
import six
from collections import MutableMapping
from franz.openrdf.model import URI
from franz.openrdf.repository import Repository
from franz.openrdf.repository.attributes import AttributeDefinition
from franz.openrdf.sail import AllegroGraphServer
from .tests import AG_HOST, AG_PORT, AG_PROXY, STORE, CATALOG, USER, PASSWORD
from six.moves import BaseHTTPServer
################################################################################
# Copyright (c) 2006-2017 Franz Inc.  
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the MIT License which accompanies
# this distribution, and is available at http://opensource.org/licenses/MIT
################################################################################

"""
Test fixtures, moved to a separate file to avoid warnings
about parameter names shadowing global symbols.
"""





# noinspection PyShadowingNames
@pytest.fixture
def conn(server):
    """
    Provides a connection to the test repository. The repository is cleared
    before the test, but not after it.
    """
    catalog = server.openCatalog(CATALOG)
    stores = catalog.listRepositories()

    # Instead of renewing the database, clear it.

# Path: src/franz/openrdf/tests/tests.py
# AG_HOST = os.environ.get('AGRAPH_HOST', LOCALHOST)
# 
# AG_PORT = int(os.environ.get('AGRAPH_PORT', '10035'))
# 
# AG_PROXY = os.environ.get('AGRAPH_PROXY')
# 
# STORE = 'agraph_test'
# 
# CATALOG = os.environ.get('AGRAPH_CATALOG', 'tests')
# 
# USER = os.environ.get('AGRAPH_USER', 'test')
# 
# PASSWORD = os.environ.get('AGRAPH_PASSWORD', 'xyzzy')


# Path: src/franz/openrdf/tests/conftest.py
import random
import uuid
import pytest
import requests
import contextlib, os, threading
import six
from collections import MutableMapping
from franz.openrdf.model import URI
from franz.openrdf.repository import Repository
from franz.openrdf.repository.attributes import AttributeDefinition
from franz.openrdf.sail import AllegroGraphServer
from .tests import AG_HOST, AG_PORT, AG_PROXY, STORE, CATALOG, USER, PASSWORD
from six.moves import BaseHTTPServer

################################################################################
# Copyright (c) 2006-2017 Franz Inc.  
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the MIT License which accompanies
# this distribution, and is available at http://opensource.org/licenses/MIT
################################################################################

"""
Test fixtures, moved to a separate file to avoid warnings
about parameter names shadowing global symbols.
"""





# noinspection PyShadowingNames
@pytest.fixture
def conn(server):
    """
    Provides a connection to the test repository. The repository is cleared
    before the test, but not after it.
    """
    catalog = server.openCatalog(CATALOG)
    stores = catalog.listRepositories()

    # Instead of renewing the database, clear it.

    mode = Repository.CREATE if STORE not in stores else Repository.OPEN