-
Notifications
You must be signed in to change notification settings - Fork 0
MPT-14713 E2E TDR Proof of concept #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| MPT_API_BASE_URL=https://api... | ||
| MPT_API_TOKEN=idt:TKN-... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import os | ||
|
|
||
| import pytest | ||
|
|
||
| from mpt_api_client import MPTClient | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def api_token(): | ||
| return os.getenv("MPT_API_TOKEN") | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def base_url(): | ||
| return os.getenv("MPT_API_BASE_URL") | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def mpt_client(api_token, base_url): | ||
| return MPTClient.from_config(api_token=api_token, base_url=base_url) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import random | ||
|
|
||
| import pytest | ||
|
|
||
| from mpt_api_client import MPTClient | ||
| from mpt_api_client.exceptions import MPTAPIError | ||
|
|
||
|
|
||
| @pytest.mark.flaky(reruns=5, reruns_delay=0.01) # noqa: WPS432 | ||
| @pytest.mark.e2e | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you remind me what marks should be here? Looks a little bit extra to have e2e folder and e2e mark at the same time
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I completely agree, we have not taken a final call in which way to go. Current setup if you run We can cleanup these marks in the future after we do the final call on the TDR. |
||
| def test_example(): | ||
| assert random.choice([True, False]) # noqa: S311 | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| @pytest.mark.e2e | ||
| def test_unauthorised(base_url): | ||
| client = MPTClient.from_config(api_token="TKN-invalid", base_url=base_url) # noqa: S106 | ||
|
|
||
| with pytest.raises(MPTAPIError, match=r"401 Unauthorized"): | ||
| client.catalog.products.fetch_page() | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| @pytest.mark.e2e | ||
| def test_access(mpt_client): | ||
| product = mpt_client.catalog.products.get("PRD-1975-5250") | ||
| assert product.id == "PRD-1975-5250" | ||
| assert product.name == "Amazon Web Services" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that the values of these parameters depend on the branch for main --> test env/ for release/* - staging env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may have to review this part. But so far we can control those variables from the pipeline setup.