|
9 | 9 | from amundsen_common.models.popular_table import PopularTable
|
10 | 10 | from amundsen_common.models.table import (Badge, Column,
|
11 | 11 | ProgrammaticDescription, Reader,
|
12 |
| - Stat, Table, User) |
| 12 | + ResourceReport, Stat, Table, User) |
13 | 13 | from apache_atlas.model.instance import AtlasRelatedObjectId
|
14 | 14 | from apache_atlas.model.relationship import AtlasRelationship
|
15 | 15 | from apache_atlas.utils import type_coerce
|
@@ -101,7 +101,17 @@ def _create_mocked_report_entities_collection(self) -> None:
|
101 | 101 | mocked_report_entity.attributes = entity['attributes']
|
102 | 102 | mocked_report_entities_collection.entities.append(mocked_report_entity)
|
103 | 103 |
|
104 |
| - self.report_entity_collection = [mocked_report_entities_collection] |
| 104 | + self.report_entity_collection = mocked_report_entities_collection |
| 105 | + |
| 106 | + def test_get_sorted_reports(self) -> None: |
| 107 | + self._create_mocked_report_entities_collection() |
| 108 | + self.report_entity_collection.entities.sort(key=lambda x: x.attributes['name'], reverse=True) |
| 109 | + self.proxy.client.entity.get_entities_by_guids = MagicMock(return_value=self.report_entity_collection) |
| 110 | + reports_guid = cast(dict, self.entity1)['attributes']['reports'] |
| 111 | + sorted_reports = self.proxy._get_reports(reports_guid) |
| 112 | + expected = [ResourceReport(name="test_report", url="http://test"), |
| 113 | + ResourceReport(name="test_report3", url="http://test3")] |
| 114 | + self.assertEqual(sorted_reports, expected) |
105 | 115 |
|
106 | 116 | def _get_table(self, custom_stats_format: bool = False) -> None:
|
107 | 117 | if custom_stats_format:
|
|
0 commit comments