@@ -0,0 +1,2114 @@
+import json%0Aimport os%0Afrom os.path import dirname, realpath%0Aimport pytest%0A%0A%0Adir_path = dirname(realpath(__file__))%0Atop_dir = dirname(dir_path)%0Atest_data_env = os.path.join(top_dir, 'data/test_data_env')%0A%0A%0A@pytest.fixture(scope=%22session%22)%0Adef monkeysession(request):%0A    %22%22%22%0A    This is an unfortunate kludge needed to force the monkeypatch fixture to%0A    allow a specific scope (the whole test session in this case).%0A%0A    Without this, Pytest would raise an error explaining this is not possible.%0A%0A    See: https://github.com/pytest-dev/pytest/issues/363%0A%0A    If this ever stops working, then the %60monkeypatch%60 needs to be done on%0A    every test method *or* the scope needs to be removed, causing these to be%0A    set for every test.%0A    %22%22%22%0A    from _pytest.monkeypatch import MonkeyPatch%0A    mpatch = MonkeyPatch()%0A    yield mpatch%0A    mpatch.undo()%0A%0A%0A@pytest.fixture(autouse=True)%0Adef set_env_vars(monkeysession):%0A    env_vars = (%0A        (%22ANCHORE_TEST_S3_ACCESS_KEY%22, %229EB92C7W61YPFQ6QLDOU%22),%0A        (%22ANCHORE_TEST_S3_SECRET_KEY%22, %22TuHo2UbBx+amD3YiCeidy+R3q82MPTPiyd+dlW+s%22),%0A        (%22ANCHORE_TEST_S3_URL%22, %22http://localhost:9000%22),%0A        (%22ANCHORE_TEST_S3_BUCKET%22, %22testarchivebucket%22),%0A        (%22ANCHORE_TEST_SWIFT_AUTH_URL%22, %22http://localhost:8080/auth/v1.0%22),%0A        (%22ANCHORE_TEST_SWIFT_KEY%22, %22testing%22),%0A        (%22ANCHORE_TEST_SWIFT_USER%22, %22test:tester%22),%0A        (%22ANCHORE_TEST_SWIFT_CONTAINER%22, %22testarchive%22),%0A        (%22ANCHORE_TEST_DB_URL%22, %22postgresql://postgres:postgres@localhost:5432/postgres%22),%0A        (%22ANCHORE_TEST_DB_USER%22, %22postgres%22),%0A        (%22ANCHORE_TEST_DB_PASS%22, %22postgres%22),%0A        (%22ANCHORE_TEST_DATA_ENV_DIR%22, test_data_env),%0A    )%0A    for environ, value in env_vars:%0A        monkeysession.setenv(environ, value)%0A%0A%0A@pytest.fixture%0Adef test_data_path():%0A    return os.path.join(top_dir, 'data')%0A%0A%0A@pytest.fixture%0Adef bundle():%0A    def find(bundle_name='bundle-large_whitelist.json'):%0A        data_dir = os.path.join(top_dir, 'data')%0A        bundle_path = os.path.join(data_dir, bundle_name)%0A        with open(bundle_path) as f:%0A            return json.load(f)%0A    return find%0A

create a conftest for integration tests that setup env vars automatically