def encode_file(): return EncodeFile( { "@id": "1", "status": "foo", "output_type": "reads", "dataset": "chip", "md5sum": "123", "quality_metrics": [{"@type": "Yes"}], } )
def test_preflight_helper_make_log_messages_from_records(preflight_helper): matches = [ MatchingMd5Record( "file", [ EncodeFile({ "@id": "/files/foo/", "status": "released", "dataset": "bar" }) ], ) ] messages = preflight_helper.make_log_messages_from_records(matches) assert messages == [ "File Path | Matching Portal Files | Portal Status | Portal File Dataset", "file | foo | released | bar ", ]
def test_encode_file_from_template(encode_common_metadata): result = EncodeFile.from_template( aliases=["foo"], assembly="mm10", common_metadata=encode_common_metadata, dataset="dataset_id", derived_from=["bar"], file_params=FileParams( { "filekey": "foo", "file_format": "bam", "file_format_type": "bar", "output_type": "reads", "derived_from_files": [], } ), file_size="123", file_md5sum="456", step_run_id="step_run_id", genome_annotation="V29", extras={"extra": "cool"}, ) assert result == { "_profile": "file", "aliases": ["foo"], "assembly": "mm10", "award": "award", "dataset": "dataset_id", "derived_from": ["bar"], "extra": "cool", "file_format": "bam", "file_format_type": "bar", "file_size": "123", "genome_annotation": "V29", "lab": "/labs/lab/", "md5sum": "456", "output_type": "reads", "status": "uploading", "step_run": "step_run_id", }
@pytest.fixture def preflight_helper(mocker): return PreflightHelper(mocker.create_autospec(Logger)) @pytest.mark.parametrize( "matches,expected", [ ( [ MatchingMd5Record( "gs://foo/a.b", [ EncodeFile({ "@id": "/files/ENCFF123ABC/", "status": "released", "dataset": "ENCSRCBA321", }), EncodeFile({ "@id": "/files/ENCFF456DEF/", "status": "in progress", "dataset": "ENCSRCBA321", }), ], ), MatchingMd5Record( "gs://foo/c.d", [ EncodeFile({ "@id": "/files/ENCFF000AAA/", "status": "revoked",
def test_encode_file_filter_encode_files_by_status(files, expected): assert len(EncodeFile.filter_encode_files_by_status(files)) == expected
"type": "text/plain", "download": "my_text_file.txt", "href": "data:text/plain;base64,Zm9vIGJhciBiYXo=", } @pytest.mark.parametrize( "other_file,expected", [ (1, False), ( EncodeFile( { "@id": "1", "status": "foo", "output_type": "reads", "dataset": "chip", "md5sum": "123", "quality_metrics": [{"@type": "Yes"}], } ), True, ), ( EncodeFile( { "@id": "1", "status": "foo", "output_type": "reads", "dataset": "atac", "md5sum": "123", "quality_metrics": [{"@type": "Yes"}],
def encode_file_no_qc(): return EncodeFile({"@id": "/files/foo/", "quality_metrics": []})