示例#1
0
 def test_get_all_uids_in_string(self):
     test_string = '{\'d41c0f1431b39b9db565b4e32a5437c61c77762a3f4401bac3bafa4887164117_24\', \'f7c927fb0c209035c7e6939bdd00eabdaada429f2ee9aeca41290412c8c79759_25\' , \'deaa23651f0a9cc247a20d0e0a78041a8e40b144e21b82081ecb519dd548eecf_24494080\'}'
     result = get_all_uids_in_string(test_string)
     self.assertEqual(len(result), 3, 'not all uids found')
     self.assertIn('d41c0f1431b39b9db565b4e32a5437c61c77762a3f4401bac3bafa4887164117_24', result, 'first uid not found')
     self.assertIn('f7c927fb0c209035c7e6939bdd00eabdaada429f2ee9aeca41290412c8c79759_25', result, 'second uid not found')
     self.assertIn('deaa23651f0a9cc247a20d0e0a78041a8e40b144e21b82081ecb519dd548eecf_24494080', result, 'third uid not found')
示例#2
0
 def _filter_replace_uid_with_file_name(self, input_data):
     tmp = input_data.__str__()
     uid_list = flt.get_all_uids_in_string(tmp)
     for item in uid_list:
         with ConnectTo(FrontEndDbInterface, self._config) as sc:
             file_name = sc.get_file_name(item)
         tmp = tmp.replace('>{}<'.format(item), '>{}<'.format(file_name))
     return tmp
示例#3
0
 def _filter_replace_uid_with_hid(self, input_data, root_uid=None):
     tmp = str(input_data)
     if tmp == 'None':
         return ' '
     uid_list = flt.get_all_uids_in_string(tmp)
     with ConnectTo(FrontEndDbInterface, self._config) as sc:
         for item in uid_list:
             tmp = tmp.replace(item, sc.get_hid(item, root_uid=root_uid))
     return tmp
示例#4
0
 def _filter_replace_uid_with_hid_link(self, input_data, root_uid=None):
     tmp = input_data.__str__()
     if tmp == 'None':
         return ' '
     uid_list = get_all_uids_in_string(tmp)
     with ConnectTo(FrontEndDbInterface, self._config) as sc:
         for item in uid_list:
             tmp = tmp.replace(item, '<a href="/analysis/{}/ro/{}">{}</a>'.format(
                 item, root_uid, sc.get_hid(item, root_uid=root_uid)))
     return tmp