def test_validate_invalid_checksum(): with open(os.path.join(BASE_PATH, 'test_e.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert 'Invalid checksum.' in str(excinfo.value)
def test_validate_invalid_metadata_size(): with open(os.path.join(BASE_PATH, 'test_h.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert str(excinfo.value) == 'Failed to decode metadata size.'
def test_validate_too_small(): with open(os.path.join(BASE_PATH, 'test_c.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert str(excinfo.value) == 'Patch too short.'
def test_validate_wrong_format(): with open(os.path.join(BASE_PATH, 'test_d.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert str(excinfo.value) == 'Invalid file format marker.'
def test_validate(bps_path): with open(bps_path, 'rb') as bps_file: bps.validate_patch(bps_file)
def test_validate_source_read_beyond_end(): with open(os.path.join(BASE_PATH, 'test_j.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert str(excinfo.value).startswith('Attempted to read beyond end of source.')
def test_validate_invalid_metadata_size_overflow(): with open(os.path.join(BASE_PATH, 'test_i.bps'), 'rb') as patch: with pytest.raises(ValueError) as excinfo: bps.validate_patch(patch) assert str(excinfo.value) == 'Metadata size too large.'