from bulk_decompress_task.handler import split_filename def test_split_filename_correct(): filepath = 'apple/artistdemographics/v1_0/report_date=2019-06-06/report_licensor=smejp/' + \ 'AppleMusic_ArtistDemographics_86780702_20190606_V1_0.txt.gz' result = split_filename(filepath) expected = { 'dsp': 'apple', 'report_type': 'artistdemographics', 'version': 'v1_0', 'licensor': 'smejp', } assert result == expected def test_split_filename_wrong_path_1(): filepath = 'apple/artistdemographics/v1_0/report_date=2019-06-06/report_licensor=smejp' result = split_filename(filepath) expected = {} assert result == expected def test_split_filename_wrong_path_2(): filepath = 'apple/artistdemographics/v1_0/report_date=2019-06-06/smejp/filename_test.txt' result = split_filename(filepath) expected = {} assert result == expected