def _get_analyzed_jstree_node_contents(self, node): result = self._get_jstree_node_contents( '<b>{}</b> (<span style="color:gray;">{}</span>)'.format( node.name, human_readable_file_size(node.size)), '/analysis/{}'.format(node.uid), '/analysis/{}'.format(node.uid), get_correct_icon_for_mime(node.type)) result['data'] = {'uid': node.uid} return result
def test_get_correct_icon_for_mime(mime_type, icon): assert get_correct_icon_for_mime(mime_type) == icon
def test_get_correct_icon_for_mime(self): self.assertEqual(get_correct_icon_for_mime('application/zip'), "/static/file_icons/archive.png") self.assertEqual(get_correct_icon_for_mime("filesystem/some_filesystem"), "/static/file_icons/filesystem.png") self.assertEqual(get_correct_icon_for_mime("some unknown mime type"), "/static/file_icons/unknown.png")