-
Notifications
You must be signed in to change notification settings - Fork 0
MPT-14885 E2E catalog product parameter groups #112
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 +1,5 @@ | ||
| { | ||
| "catalog.product.id": "PRD-7255-3950", | ||
| "accounts.seller.id": "SEL-7310-3075" | ||
| "accounts.seller.id": "SEL-7310-3075", | ||
| "catalog.product.parameter_group.id": "PGR-7255-3950-0001" | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
| import pytest | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def parameter_group_id(e2e_config): | ||
| return e2e_config["catalog.product.parameter_group.id"] | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def parameter_group_data(): | ||
| return { | ||
| "name": "e2e - please delete", | ||
| "label": "e2e - please delete", | ||
| "displayOrder": 100, | ||
| } |
51 changes: 51 additions & 0 deletions
51
tests/e2e/catalog/product/parameter_groups/test_async_parameter_groups.py
This file contains hidden or 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,51 @@ | ||
| import pytest | ||
|
|
||
| from mpt_api_client.exceptions import MPTAPIError | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| async def async_created_parameter_group(logger, async_mpt_vendor, product_id, parameter_group_data): | ||
| service = async_mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| group = await service.create(parameter_group_data) | ||
| yield group | ||
| try: | ||
| await service.delete(group.id) | ||
| except MPTAPIError as error: | ||
| print(f"TEARDOWN - Unable to delete parameter group {group.id}: {error.title}") # noqa: WPS421 | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_create_parameter_group(async_created_parameter_group): | ||
| assert async_created_parameter_group.name == "e2e - please delete" | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| async def test_update_parameter_group(async_mpt_vendor, product_id, async_created_parameter_group): | ||
| service = async_mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| update_data = {"name": "e2e - delete me (updated)"} | ||
| group = await service.update(async_created_parameter_group.id, update_data) | ||
| assert group.name == "e2e - delete me (updated)" | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| async def test_get_parameter_group(async_mpt_vendor, product_id, parameter_group_id): | ||
| service = async_mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| group = await service.get(parameter_group_id) | ||
| assert group.id == parameter_group_id | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| async def test_iterate_parameter_groups( | ||
| async_mpt_vendor, product_id, async_created_parameter_group | ||
| ): | ||
| service = async_mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| groups = [group async for group in service.iterate()] | ||
| assert any(group.id == async_created_parameter_group.id for group in groups) | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| async def test_delete_parameter_group(async_mpt_vendor, product_id, async_created_parameter_group): | ||
| service = async_mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| await service.delete(async_created_parameter_group.id) | ||
| with pytest.raises(MPTAPIError): | ||
| await service.get(async_created_parameter_group.id) |
49 changes: 49 additions & 0 deletions
49
tests/e2e/catalog/product/parameter_groups/test_sync_parameter_groups.py
This file contains hidden or 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,49 @@ | ||
| import pytest | ||
|
|
||
| from mpt_api_client.exceptions import MPTAPIError | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def created_parameter_group(logger, mpt_vendor, product_id, parameter_group_data): | ||
| service = mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| group = service.create(parameter_group_data) | ||
| yield group | ||
| try: | ||
| service.delete(group.id) | ||
| except MPTAPIError as error: | ||
| print(f"TEARDOWN - Unable to delete parameter group {group.id}: {error.title}") # noqa: WPS421 | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_create_parameter_group(created_parameter_group): | ||
| assert created_parameter_group.name == "e2e - please delete" | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_update_parameter_group(mpt_vendor, product_id, created_parameter_group): | ||
| service = mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| update_data = {"name": "please delete me"} | ||
| group = service.update(created_parameter_group.id, update_data) | ||
| assert group.name == "please delete me" | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_get_parameter_group_get(mpt_vendor, product_id, parameter_group_id): | ||
| service = mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| group = service.get(parameter_group_id) | ||
| assert group.id == parameter_group_id | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_iterate_parameter_groups(mpt_vendor, product_id, created_parameter_group): | ||
| service = mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| groups = list(service.iterate()) | ||
| assert any(group.id == created_parameter_group.id for group in groups) | ||
|
|
||
|
|
||
| @pytest.mark.flaky | ||
| def test_delete_parameter_group(mpt_vendor, product_id, created_parameter_group): | ||
| service = mpt_vendor.catalog.products.parameter_groups(product_id) | ||
| service.delete(created_parameter_group.id) | ||
| with pytest.raises(MPTAPIError): | ||
| service.get(created_parameter_group.id) |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.