Beispiel #1
0
    def test_rel_mock_get_metadata(self):
        index = GDCIndexClient(uri=base_url)
        index._get_metadata(['small_rel'])

        assert index.get_access('small_rel') == uuids['small_rel']['access']
        assert index.get_filesize('small_rel') == uuids['small_rel']['file_size']
        assert index.get_md5sum('small_rel') == uuids['small_rel']['md5sum']
        assert index.get_related_files('small_rel') == uuids['small_rel']['related_files']
        assert index.get_annotations('small_rel') == []
Beispiel #2
0
    def test_big_and_small_no_rel_no_ann_separate_small_files(self):
        index = GDCIndexClient(uri=base_url)
        bigs, smalls = index.separate_small_files(
                ['big_no_friends', 'small_no_friends'],
                HTTP_CHUNK_SIZE,
                related_files=True,
                annotations=True)

        assert index.get_access('big_no_friends') == uuids['big_no_friends']['access']
        assert index.get_filesize('big_no_friends') == uuids['big_no_friends']['file_size']
        assert index.get_md5sum('big_no_friends') == uuids['big_no_friends']['md5sum']
        assert index.get_related_files('big_no_friends') == []
        assert index.get_annotations('big_no_friends') == []

        assert index.get_access('small_no_friends') == uuids['small_no_friends']['access']
        assert index.get_filesize('small_no_friends') == uuids['small_no_friends']['file_size']
        assert index.get_md5sum('small_no_friends') == uuids['small_no_friends']['md5sum']
        assert index.get_related_files('small_no_friends') == []
        assert index.get_annotations('small_no_friends') == []

        assert bigs == ['big_no_friends']
        assert smalls == [['small_no_friends']]
Beispiel #3
0
    def test_big_and_small_full_separate_small_files(self):
        index = GDCIndexClient(uri=base_url)
        bigs, smalls = index.separate_small_files(
                ['big', 'small'],
                HTTP_CHUNK_SIZE,
                related_files=True,
                annotations=True)

        assert index.get_access('big') == uuids['big']['access']
        assert index.get_filesize('big') == uuids['big']['file_size']
        assert index.get_md5sum('big') == uuids['big']['md5sum']
        assert index.get_related_files('big') == uuids['big']['related_files']
        assert index.get_annotations('big') == uuids['big']['annotations']

        assert index.get_access('small') == uuids['small']['access']
        assert index.get_filesize('small') == uuids['small']['file_size']
        assert index.get_md5sum('small') == uuids['small']['md5sum']
        assert index.get_related_files('small') == uuids['small']['related_files']
        assert index.get_annotations('small') == uuids['small']['annotations']

        # if a uuid has related files or annotations then they
        # are downloaded as big files
        assert bigs == ['big', 'small']
        assert smalls == []
Beispiel #4
0
    def test_small_invalid_separate_small_files(self):
        """ If no metadata can be found about a file, attempt a
        download using the big file method
        """

        invalid = 'invalid uuid'

        index = GDCIndexClient(uri=base_url)
        bigs, smalls = index.separate_small_files(
                [invalid],
                HTTP_CHUNK_SIZE,
                related_files=True,
                annotations=True)

        assert index.get_access(invalid) == None
        assert index.get_filesize(invalid) == None
        assert index.get_md5sum(invalid) == None
        assert index.get_related_files(invalid) == []
        assert index.get_annotations(invalid) == []

        assert bigs == [invalid]
        assert smalls == []
Beispiel #5
0
    def test_small_full_separate_small_files(self):
        """ Currently if a file has related or annotation files
        the dtt processes it as if it were a big file so that
        it goes through the old method of downloading,
        regardless of size.

        NOTE: This will probably change in the future.
        """

        index = GDCIndexClient(uri=base_url)
        bigs, smalls = index.separate_small_files(
                ['small'],
                HTTP_CHUNK_SIZE,
                related_files=True,
                annotations=True)

        assert index.get_access('small') == uuids['small']['access']
        assert index.get_filesize('small') == uuids['small']['file_size']
        assert index.get_md5sum('small') == uuids['small']['md5sum']
        assert index.get_related_files('small') == uuids['small']['related_files']
        assert index.get_annotations('small') == uuids['small']['annotations']

        assert bigs == ['small']
        assert smalls == []
Beispiel #6
0
    def test_no_metadata_get_filesize(self):
        index = GDCIndexClient(uri=base_url)

        results = index.get_access(uuids['small'])
        assert results == None