File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,21 @@ class CheckResult:
149149 resource_type : str | None = None
150150 """The resource type name if this check is related to a specific resource."""
151151
152+ def __repr__ (self ):
153+ """Return string representation without verbose description field."""
154+ parts = [f"CheckResult(status={ self .status !r} " ]
155+ if self .title :
156+ parts .append (f"title={ self .title !r} " )
157+ if self .reason :
158+ parts .append (f"reason={ self .reason !r} " )
159+ if self .data is not None :
160+ parts .append (f"data={ self .data !r} " )
161+ if self .tags :
162+ parts .append (f"tags={ self .tags !r} " )
163+ if self .resource_type :
164+ parts .append (f"resource_type={ self .resource_type !r} " )
165+ return ", " .join (parts ) + ")"
166+
152167
153168class ResourceManager :
154169 """Manages SCIM resources with automatic cleanup for tests."""
Original file line number Diff line number Diff line change @@ -413,3 +413,35 @@ def test_compare_field_with_none_values():
413413
414414 # Test when both are None
415415 assert compare_field (None , None ) is False
416+
417+
418+ def test_check_result_repr ():
419+ """Test CheckResult __repr__ excludes description field."""
420+ result = CheckResult (
421+ status = Status .SUCCESS ,
422+ title = "Test" ,
423+ description = "Long verbose description that should not appear" ,
424+ )
425+ repr_str = repr (result )
426+ assert "description" not in repr_str
427+ assert "Status.SUCCESS" in repr_str
428+ assert "title='Test'" in repr_str
429+
430+ result = CheckResult (
431+ status = Status .ERROR ,
432+ title = "Complex Check" ,
433+ description = "Very long description" ,
434+ reason = "Failed" ,
435+ data = {"key" : "value" },
436+ tags = {"crud:read" },
437+ resource_type = "User" ,
438+ )
439+ repr_str = repr (result )
440+ assert "description" not in repr_str
441+ assert "Status.ERROR" in repr_str
442+ assert "title='Complex Check'" in repr_str
443+ assert "reason='Failed'" in repr_str
444+ assert "data={'key': 'value'}" in repr_str
445+ assert "tags={'crud:read'}" in repr_str
446+ assert "resource_type='User'" in repr_str
447+ assert result .description == "Very long description"
You can’t perform that action at this time.
0 commit comments