Skip to content
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

Added support for object integrity level boundary #35

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/pytmv1/model/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ class EndpointActivity(BaseConsumable):
tags: List[str] = Field(default=[])
uuid: Optional[str] = None

@field_validator("object_integrity_level", mode="before")
@classmethod
def map_object_integrity_level(
cls, value: Optional[int]
) -> Optional[IntegrityLevel]:
if value:
if IntegrityLevel.UNTRUSTED <= value < IntegrityLevel.LOW:
return IntegrityLevel.UNTRUSTED
if IntegrityLevel.LOW <= value < IntegrityLevel.MEDIUM:
return IntegrityLevel.LOW
if IntegrityLevel.MEDIUM <= value < IntegrityLevel.HIGH:
return IntegrityLevel.MEDIUM
if IntegrityLevel.HIGH <= value < IntegrityLevel.SYSTEM:
return IntegrityLevel.HIGH
return IntegrityLevel.SYSTEM
return None


class HostInfo(BaseModel):
name: str
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pytmv1 import (
GetEmailActivitiesCountResp,
GetEndpointActivitiesCountResp,
IntegrityLevel,
ListEmailActivityResp,
ListEndpointActivityResp,
ListEndpointDataResp,
Expand Down Expand Up @@ -45,6 +46,10 @@ def test_list_endpoint_activities(client):
assert result.result_code == ResultCode.SUCCESS
assert isinstance(result.response, ListEndpointActivityResp)
assert len(result.response.items) > 0
assert (
result.response.items[0].object_integrity_level
== IntegrityLevel.MEDIUM
)


def test_get_endpoint_activities_count(client):
Expand Down
Loading