def test__md5_updater_4(): inputjson = {'status': 'uploading', 'md5sum': '1234', 'content_md5sum': '5678' } md5 = '1234' content_md5 = '0000' with pytest.raises(Exception) as excinfo: _md5_updater(inputjson, md5, content_md5) assert str(excinfo.value) == "content md5 not matching the original one"
def test__md5_updater_2(): inputjson = {'status': 'uploading', 'md5sum': '1234', 'content_md5sum': '5678' } md5 = None content_md5 = '5678' new_file = _md5_updater(inputjson, md5, content_md5) assert new_file == {}
def test__md5_updater_4(): inputjson = { 'status': 'uploading', 'md5sum': '1234', 'content_md5sum': '5678' } md5 = '1234' content_md5 = '0000' new_file = _md5_updater(inputjson, md5, content_md5) assert new_file == 'Failed'
def test__md5_updater_7(): inputjson = {'status': 'uploading', 'md5sum': '1234'} md5 = None content_md5 = '5678' new_file = _md5_updater(inputjson, md5, content_md5) assert new_file assert 'content_md5sum' in new_file assert new_file['content_md5sum'] == '5678' assert 'md5sum' not in new_file assert 'status' in new_file assert new_file['status'] == 'uploaded'
def test__md5_updater_file_size(): inputjson = {'status': 'uploaded', 'md5sum': '1234', } md5 = '1234' content_md5 = '5678' new_file = _md5_updater(inputjson, md5, content_md5, file_size=6789) assert new_file assert 'content_md5sum' in new_file assert new_file['content_md5sum'] == '5678' assert 'md5sum' not in new_file assert 'status' not in new_file assert 'file_size' in new_file assert new_file['file_size'] == 6789
def test__md5_updater_extra_file(): inputjson = {'status': 'uploaded', 'md5sum': '1234', 'extra_files': [ { 'file_format': 'pairs_px2' } ] } md5 = '1234' content_md5 = '5678' new_file = _md5_updater(inputjson, md5, content_md5, format_if_extra='pairs_px2') assert new_file assert 'extra_files' in new_file assert new_file['extra_files'][0]['file_format'] == 'pairs_px2' assert new_file['extra_files'][0]['md5sum'] == '1234' assert new_file['extra_files'][0]['content_md5sum'] == '5678' assert 'md5sum' not in new_file assert 'content_md5sum' not in new_file assert 'status' not in new_file