def test_clone_complexe(self): from papaye.proxy import clone from papaye.models import Package, Release, ReleaseFile package = Package(name='pyramid') package['1.3'] = Release(version='1.3', metadata={}) package['1.4'] = Release(version='1.4', metadata={}) package['1.5'] = Release(version='1.5', metadata={}) package['1.3']['pyramid-1.3.tar.gz'] = ReleaseFile( filename='pyramid-1.3.tar.gz', content=b'a existing content', md5_digest='12345' ) package['1.4']['pyramid-1.4.tar.gz'] = ReleaseFile( filename='pyramid-1.4.tar.gz', content=b'a existing content', md5_digest='12345' ) package['1.5']['pyramid-1.5.tar.gz'] = ReleaseFile( filename='pyramid-1.5.tar.gz', content=b'a existing content', md5_digest='12345' ) package['1.5']['pyramid-1.5.whl'] = ReleaseFile( filename='pyramid-1.5.whl', content=b'a existing content', md5_digest='12345' ) result = clone(package) assert result is not None assert result is not package assert ['1.3', '1.4', '1.5'] == list(result.releases.keys()) for release_name in ['1.3', '1.4', '1.5']: assert result[release_name] != package[release_name] assert 'pyramid-1.3.tar.gz' in list(result['1.3'].release_files.keys()) release_file = result['1.3']['pyramid-1.3.tar.gz'] assert release_file is not package['1.3']['pyramid-1.3.tar.gz'] assert release_file.path == package['1.3']['pyramid-1.3.tar.gz'].path assert release_file.md5_digest == package['1.3']['pyramid-1.3.tar.gz'].md5_digest assert release_file.size == package['1.3']['pyramid-1.3.tar.gz'].size release_file = result['1.4']['pyramid-1.4.tar.gz'] assert release_file is not package['1.4']['pyramid-1.4.tar.gz'] assert release_file.path == package['1.4']['pyramid-1.4.tar.gz'].path assert release_file.md5_digest == package['1.4']['pyramid-1.4.tar.gz'].md5_digest assert release_file.size == package['1.4']['pyramid-1.4.tar.gz'].size release_file = result['1.5']['pyramid-1.5.tar.gz'] assert release_file is not package['1.5']['pyramid-1.5.tar.gz'] assert release_file.path == package['1.5']['pyramid-1.5.tar.gz'].path assert release_file.md5_digest == package['1.5']['pyramid-1.5.tar.gz'].md5_digest assert release_file.size == package['1.5']['pyramid-1.5.tar.gz'].size release_file = result['1.5']['pyramid-1.5.whl'] assert release_file is not package['1.5']['pyramid-1.5.whl'] assert release_file.path == package['1.5']['pyramid-1.5.whl'].path assert release_file.md5_digest == package['1.5']['pyramid-1.5.whl'].md5_digest assert release_file.size == package['1.5']['pyramid-1.5.whl'].size
def test_clone(self): from papaye.proxy import clone from papaye.models import Package, Release, ReleaseFile package = Package(name='pyramid') package['1.5'] = Release(version='1.5', metadata={}) package['1.5']['pyramid-1.5.tar.gz'] = ReleaseFile( filename='pyramid-1.5.tar.gz', content=b'a existing content', md5_digest='12345' ) result = clone(package) assert result is not None assert result is not package assert result.__name__ == package.__name__ assert '1.5' in list(result.releases.keys()) assert result['1.5'] is not package['1.5']