Skip to content
Snippets Groups Projects

Resolve "Allow usage of the Personal Authentication Token (PAT)"

+ 18
4
@@ -51,33 +51,45 @@ class TestClient(unittest.TestCase):
self.assertEqual(list(files_t.index), list(files_a.index))
def test_datafile_get_ann(self):
"""
Test the retrieval of annotation for a file
"""
dataset_id = self.client_token.datasets.index[0]
files_i = self.client_token.get_datafiles_list(dataset_id=dataset_id)
annotation = self.client_token.get_file_annotation(files_i.index[0])
self.assertIsInstance(annotation, dict)
@unittest.skip('Skip this test')
def test_dataset_filter(self):
"""
Test that the retrieval of a specific dataset using its name
"""
# Specific dataset - won't work for everyone
dataset = self.client_token.filter_datasets('Test')
dataset_id = dataset.index[0]
self.assertEqual(dataset_id, "DSB6D767D2")
def test_dataset_get_files_ann(self):
"""
Test the retrieval of a file by annotation key and value
"""
# Get dataset info
#dataset = self.client_token.filter_datasets('Test')
dataset_id = self.client_token.datasets.index[0]
# Get File and its annotation
files_i = self.client_token.get_datafiles_list(dataset_id=dataset_id)
file_id = files_i.index[1]
annotation = self.client_token.get_file_annotation(file_id)
key, value = list(annotation.items())[0]
# Test method from an annotation query
# Test that the file id is in the list of files retrieved by key:value
files_t = self.client_token.get_datafiles_list(key_anno=key, value_anno=value)
self.assertTrue(file_id in list(files_t.index))
@unittest.skip('Skip this test')
def test_wrong_dataset_id(self):
"""
Test using a wrong dataset id
"""
dataset_id = 'DS00001'
files_t = self.client_token.get_datafiles_list(dataset_id=dataset_id)
self.assertTrue(len(files_t)==0)
@@ -85,4 +97,6 @@ class TestClient(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
Loading