generated from MITLibraries/python-cli-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3aa2fbb
commit 5d31cfe
Showing
9 changed files
with
139 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import os | ||
|
||
import pytest | ||
import vcr | ||
from click.testing import CliRunner | ||
|
||
from tim.opensearch import configure_opensearch_client | ||
|
||
EXIT_CODES = { | ||
"success": 0, | ||
"error": 1, | ||
"invalid_command": 2, | ||
} | ||
my_vcr = vcr.VCR( | ||
cassette_library_dir="tests/fixtures/cassettes", | ||
filter_headers=["authorization"], | ||
) | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def test_env(): | ||
os.environ = { | ||
"AWS_ACCESS_KEY_ID": "test", | ||
"AWS_SECRET_ACCESS_KEY": "test", | ||
"AWS_SESSION_TOKEN": "test", | ||
"TIMDEX_OPENSEARCH_ENDPOINT": "localhost", | ||
"SENTRY_DSN": None, | ||
"WORKSPACE": "test", | ||
} | ||
yield | ||
|
||
|
||
@pytest.fixture() | ||
def _test_env(monkeypatch): | ||
monkeypatch.setenv("SENTRY_DSN", "None") | ||
monkeypatch.setenv("WORKSPACE", "test") | ||
monkeypatch.setenv("AWS_ACCESS_KEY_ID", "test") | ||
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "test") | ||
monkeypatch.setenv("AWS_SESSION_TOKEN", "test") | ||
monkeypatch.setenv("TIMDEX_OPENSEARCH_ENDPOINT", "localhost") | ||
|
||
|
||
@pytest.fixture | ||
def test_opensearch_client(): | ||
return configure_opensearch_client("localhost") | ||
|
||
|
||
@pytest.fixture() | ||
@pytest.fixture | ||
def runner(): | ||
return CliRunner() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.