-
Notifications
You must be signed in to change notification settings - Fork 0
MPT-14939 E2E for audit event_types #175
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
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| from typing import Any | ||
|
|
||
| import pytest | ||
|
|
||
| from mpt_api_client import AsyncMPTClient, MPTClient | ||
| from mpt_api_client.resources.audit.event_types import ( | ||
| AsyncEventTypesService, | ||
| EventType, | ||
| EventTypesService, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def event_types_service(mpt_vendor: MPTClient) -> EventTypesService: | ||
| return mpt_vendor.audit.event_types | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def async_event_types_service(async_mpt_vendor: AsyncMPTClient) -> AsyncEventTypesService: | ||
| return async_mpt_vendor.audit.event_types | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def event_type(event_types_service: EventTypesService) -> EventType: | ||
| return next(event_types_service.iterate()) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def event_type_update_data() -> dict[str, Any]: | ||
| return { | ||
| "description": "Updated description for e2e testing", | ||
| } |
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,44 @@ | ||
| from typing import Any | ||
|
|
||
| import pytest | ||
|
|
||
| from mpt_api_client.exceptions import MPTAPIError | ||
| from mpt_api_client.resources.audit.event_types import AsyncEventTypesService, EventType | ||
| from mpt_api_client.rql.query_builder import RQLQuery | ||
|
|
||
| pytestmark = [pytest.mark.flaky] | ||
|
|
||
|
|
||
| async def test_get_event_type( | ||
| async_event_types_service: AsyncEventTypesService, event_type: EventType | ||
| ) -> None: | ||
| result = await async_event_types_service.get(event_type.id) | ||
|
|
||
| assert result.id == event_type.id | ||
| assert result.key == event_type.key | ||
|
|
||
|
|
||
| async def test_filter_event_types( | ||
| async_event_types_service: AsyncEventTypesService, event_type: EventType | ||
| ) -> None: | ||
| iterator = async_event_types_service.filter(RQLQuery(id=event_type.id)).iterate() | ||
|
|
||
| result = [event_type_item async for event_type_item in iterator] | ||
|
|
||
| assert len(result) == 1 | ||
| assert result[0].id == event_type.id | ||
|
|
||
|
|
||
| async def test_update_event_type( | ||
| async_event_types_service: AsyncEventTypesService, | ||
| event_type: EventType, | ||
| event_type_update_data: dict[str, Any], | ||
| ) -> None: | ||
| result = await async_event_types_service.update(event_type.id, event_type_update_data) | ||
|
|
||
| assert result.id == event_type.id | ||
|
|
||
|
|
||
| async def test_get_event_type_not_found(async_event_types_service: AsyncEventTypesService) -> None: | ||
| with pytest.raises(MPTAPIError, match=r"404 Not Found"): | ||
| await async_event_types_service.get("EVT-000-000") | ||
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,38 @@ | ||
| from typing import Any | ||
|
|
||
| import pytest | ||
|
|
||
| from mpt_api_client.exceptions import MPTAPIError | ||
| from mpt_api_client.resources.audit.event_types import EventType, EventTypesService | ||
| from mpt_api_client.rql.query_builder import RQLQuery | ||
|
|
||
| pytestmark = [pytest.mark.flaky] | ||
|
|
||
|
|
||
| def test_get_event_type(event_types_service: EventTypesService, event_type: EventType) -> None: | ||
| result = event_types_service.get(event_type.id) | ||
|
|
||
| assert result.id == event_type.id | ||
| assert result.key == event_type.key | ||
|
|
||
|
|
||
| def test_filter_event_types(event_types_service: EventTypesService, event_type: EventType) -> None: | ||
| result = list(event_types_service.filter(RQLQuery(id=event_type.id)).iterate()) | ||
|
|
||
| assert len(result) == 1 | ||
| assert result[0].id == event_type.id | ||
|
|
||
|
|
||
| def test_update_event_type( | ||
| event_types_service: EventTypesService, | ||
| event_type: EventType, | ||
| event_type_update_data: dict[str, Any], | ||
| ) -> None: | ||
| result = event_types_service.update(event_type.id, event_type_update_data) | ||
|
|
||
| assert result.id == event_type.id | ||
|
|
||
|
|
||
| def test_get_event_type_not_found(event_types_service: EventTypesService) -> None: | ||
| with pytest.raises(MPTAPIError, match=r"404 Not Found"): | ||
| event_types_service.get("EVT-000-000") |
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.