-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: bad filter should raise OscApiException with error code 400 (#121
) closes #116 Signed-off-by: Jérôme Jutteau <[email protected]>
- Loading branch information
1 parent
010a533
commit 7049820
Showing
2 changed files
with
42 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
from dataclasses import dataclass | ||
|
||
import pytest | ||
|
||
from . import sdk | ||
|
||
|
||
@dataclass | ||
class Env(object): | ||
access_key: str | ||
secret_key: str | ||
endpoint_api: str | ||
region: str | ||
|
||
|
||
@pytest.fixture | ||
def env() -> Env: | ||
return Env( | ||
access_key=os.getenv("OSC_TEST_ACCESS_KEY", ""), | ||
secret_key=os.getenv("OSC_TEST_SECRET_KEY", ""), | ||
endpoint_api=os.getenv("OSC_TEST_ENDPOINT_API", ""), | ||
region=os.getenv("OSC_TEST_REGION", ""), | ||
) | ||
|
||
|
||
# issue #116 | ||
def test_bad_filter(env): | ||
oapi = sdk.OSCCall( | ||
access_key=env.access_key, | ||
secret_key=env.secret_key, | ||
endpoint=env.endpoint_api, | ||
region_name=env.region, | ||
) | ||
with pytest.raises(sdk.OscApiException) as e: | ||
oapi.make_request("ReadImages", Filters='"bad_filter"') | ||
assert e.value.status_code == 400 |