def _test_resolve_tree(self): folders = self._test_folders() full_folders = {i['id']: copy.deepcopy(i) for i in folders} for folder in full_folders.values(): folder['properties']['name'] = folder.pop('name') folder['properties']['waypoints'] = [{ 'id': i, 'title': 'waypoint_%s' % i, 'properties': {} } for i in folder['properties']['waypoints']] folder['properties']['tracks'] = [{ 'id': i, 'title': 'track_%s' % i, 'properties': {} } for i in folder['properties']['tracks']] fake_client = mock.MagicMock() fake_client.get_object.side_effect = lambda t, id_: full_folders[id_] fake_client.list_objects.return_value = [{ 'title': 'testdata', 'properties': {}, 'folder': '' }] tree = util.make_tree(folders) resolved = util.resolve_tree(fake_client, tree) return resolved
def default(self, args): folders = self.client.list_objects('folder') root = util.make_tree(folders) tree = util.resolve_tree(self.client, root) util.pprint_folder(tree)