|
16 | 16 | from harborapi.exceptions import UnprocessableEntity
|
17 | 17 | from harborapi.models import HarborVulnerabilityReport
|
18 | 18 | from harborapi.models.buildhistory import BuildHistoryEntry
|
| 19 | +from harborapi.models.mappings import FirstDict |
19 | 20 | from harborapi.models.models import Accessory
|
20 | 21 | from harborapi.models.models import Artifact
|
21 | 22 | from harborapi.models.models import Label
|
@@ -120,6 +121,11 @@ async def test_get_artifact_vulnerability_reports_mock(
|
120 | 121 | for mime_type, report in r.items():
|
121 | 122 | assert report == report
|
122 | 123 | assert mime_type in MIME_TYPES
|
| 124 | + # Test return type |
| 125 | + assert isinstance(r, dict) |
| 126 | + assert isinstance(r, FirstDict) |
| 127 | + assert r.first() == report |
| 128 | + assert list(r.values()) == [report, report, report] |
123 | 129 |
|
124 | 130 |
|
125 | 131 | @pytest.mark.asyncio
|
@@ -152,6 +158,9 @@ async def test_get_artifact_vulnerability_reports_single_mock(
|
152 | 158 | )
|
153 | 159 | assert len(r) == 1
|
154 | 160 | assert r[mime_type] == report
|
| 161 | + # Test FirstDict methods |
| 162 | + assert r.first() == report |
| 163 | + assert list(r.values()) == [report] |
155 | 164 |
|
156 | 165 |
|
157 | 166 | @pytest.mark.asyncio
|
@@ -192,6 +201,11 @@ async def test_get_artifact_vulnerability_reports_raw_mock(
|
192 | 201 | assert report == report_dict
|
193 | 202 | assert mime_type in MIME_TYPES
|
194 | 203 |
|
| 204 | + # Even in Raw mode, we should still get a FirstDict |
| 205 | + assert isinstance(r, FirstDict) |
| 206 | + assert r.first() == report_dict |
| 207 | + assert list(r.values()) == [report_dict, report_dict, report_dict] |
| 208 | + |
195 | 209 |
|
196 | 210 | @pytest.mark.asyncio
|
197 | 211 | @given(st.lists(st.builds(BuildHistoryEntry)))
|
|
0 commit comments