@@ -52,6 +52,7 @@ def test_allowed_violation(self) -> None:
5252 )
5353 assert v .status == SsrfViolationStatus .ALLOWED
5454 assert v .resolved_by == "user-1"
55+ assert v .resolved_at == _NOW + timedelta (minutes = 5 )
5556
5657 def test_denied_violation (self ) -> None :
5758 v = SsrfViolation (
@@ -65,6 +66,8 @@ def test_denied_violation(self) -> None:
6566 resolved_at = _NOW + timedelta (minutes = 5 ),
6667 )
6768 assert v .status == SsrfViolationStatus .DENIED
69+ assert v .resolved_by == "admin-1"
70+ assert v .resolved_at == _NOW + timedelta (minutes = 5 )
6871
6972 def test_frozen (self ) -> None :
7073 v = SsrfViolation (
@@ -89,6 +92,18 @@ def test_pending_with_resolved_by_rejected(self) -> None:
8992 resolved_by = "user-1" ,
9093 )
9194
95+ def test_pending_with_resolved_at_rejected (self ) -> None :
96+ with pytest .raises (ValidationError , match = "resolved_at" ):
97+ SsrfViolation (
98+ id = "v-bad" ,
99+ timestamp = _NOW ,
100+ url = "http://example.com:80" ,
101+ hostname = "example.com" ,
102+ port = 80 ,
103+ status = SsrfViolationStatus .PENDING ,
104+ resolved_at = _NOW + timedelta (minutes = 5 ),
105+ )
106+
92107 def test_allowed_without_resolved_by_rejected (self ) -> None :
93108 with pytest .raises (ValidationError , match = "resolved_by" ):
94109 SsrfViolation (
@@ -100,6 +115,17 @@ def test_allowed_without_resolved_by_rejected(self) -> None:
100115 status = SsrfViolationStatus .ALLOWED ,
101116 )
102117
118+ def test_denied_without_resolved_by_rejected (self ) -> None :
119+ with pytest .raises (ValidationError , match = "resolved_by" ):
120+ SsrfViolation (
121+ id = "v-bad" ,
122+ timestamp = _NOW ,
123+ url = "http://example.com:80" ,
124+ hostname = "example.com" ,
125+ port = 80 ,
126+ status = SsrfViolationStatus .DENIED ,
127+ )
128+
103129 def test_port_bounds (self ) -> None :
104130 with pytest .raises (ValidationError , match = "port" ):
105131 SsrfViolation (
0 commit comments