|
1 | 1 | from django.test import TestCase
|
2 |
| - |
| 2 | +from openarchiefbeheer.destruction.tests.factories import \ |
| 3 | + DestructionListItemFactory |
| 4 | +from openarchiefbeheer.utils.results_store import ResultStore |
| 5 | +from openarchiefbeheer.zaken.utils import (delete_zaak_and_related_objects, |
| 6 | + format_zaaktype_choices) |
3 | 7 | from requests.exceptions import ConnectTimeout
|
4 | 8 | from requests_mock import Mocker
|
5 | 9 | from rest_framework import status
|
6 | 10 | from zgw_consumers.constants import APITypes
|
7 | 11 | from zgw_consumers.test.factories import ServiceFactory
|
8 | 12 |
|
9 |
| -from openarchiefbeheer.destruction.tests.factories import DestructionListItemFactory |
10 |
| -from openarchiefbeheer.utils.results_store import ResultStore |
11 |
| -from openarchiefbeheer.zaken.utils import ( |
12 |
| - delete_zaak_and_related_objects, |
13 |
| - format_zaaktype_choices, |
14 |
| -) |
15 |
| - |
16 | 13 |
|
17 | 14 | class DeletingZakenWithErrorsTests(TestCase):
|
18 | 15 | @classmethod
|
@@ -151,6 +148,7 @@ def test_failure_on_deleting_zaak_relation_is_handled(self, m):
|
151 | 148 | class FormatZaaktypeChoicesTests(TestCase):
|
152 | 149 | def test_format_zaaktype_choices_with_multiple_versions(self):
|
153 | 150 | # Test that the function picks the latest version of each zaaktype based on versiedatum
|
| 151 | + # And test that the output is sorted by label |
154 | 152 | zaaktypen = [
|
155 | 153 | {
|
156 | 154 | "identificatie": "ZKT-001",
|
@@ -217,35 +215,3 @@ def test_format_zaaktype_choices_with_empty_input(self):
|
217 | 215 | # Should return an empty list
|
218 | 216 | result = format_zaaktype_choices(zaaktypen)
|
219 | 217 | self.assertEqual(result, expected_result)
|
220 |
| - |
221 |
| - def test_format_zaaktype_choices_sorted_output(self): |
222 |
| - # Test that the output is sorted by label |
223 |
| - zaaktypen = [ |
224 |
| - { |
225 |
| - "identificatie": "ZKT-002", |
226 |
| - "url": "http://localhost:8000/api/v1/zaaktypen/2", |
227 |
| - "omschrijving": "Zaaktype B", |
228 |
| - "versiedatum": "2023-01-01", |
229 |
| - }, |
230 |
| - { |
231 |
| - "identificatie": "ZKT-001", |
232 |
| - "url": "http://localhost:8000/api/v1/zaaktypen/1", |
233 |
| - "omschrijving": "Zaaktype A", |
234 |
| - "versiedatum": "2023-01-01", |
235 |
| - }, |
236 |
| - ] |
237 |
| - |
238 |
| - # Expecting the results to be sorted alphabetically by label |
239 |
| - expected_result = [ |
240 |
| - { |
241 |
| - "label": "Zaaktype A (ZKT-001)", |
242 |
| - "value": "http://localhost:8000/api/v1/zaaktypen/1", |
243 |
| - }, |
244 |
| - { |
245 |
| - "label": "Zaaktype B (ZKT-002)", |
246 |
| - "value": "http://localhost:8000/api/v1/zaaktypen/2", |
247 |
| - }, |
248 |
| - ] |
249 |
| - |
250 |
| - result = format_zaaktype_choices(zaaktypen) |
251 |
| - self.assertEqual(result, expected_result) |
0 commit comments