def test_download(self): test_dir = tempfile.mkdtemp() self.dirs.append(test_dir) rd = RemoteDistribution( self.mock_repo(), '../../packages/source/p/pkgsync/pkgsync-0.1.0.tar.gz#md5=%s' % self.empty_digest, 'pkgsync', ) dist = rd.download(save_to=test_dir) downloaded_file_path = os.path.join(test_dir, 'pkgsync-0.1.0.tar.gz') self.assertTrue(os.path.isfile(downloaded_file_path)) self.assertEqual(dist.path, downloaded_file_path)
def test_up_to_date(self): distribution = RemoteDistribution( self.mock_repo(), '../../packages/source/p/pkgsync/pkgsync-0.1.0.tar.gz#md5=%s' % self.empty_digest, 'pkgsync', ) self.assertEqual(RemoteDistribution.diff([distribution], [distribution]), [])
def test_tgz_and_zip(self): repo = self.mock_repo() tgz_d = RemoteDistribution( repo, '../../packages/source/p/pkgsync/pkgsync-0.1.0.tar.gz#md5=%s' % self.empty_digest, 'pkgsync', ) zip_d = RemoteDistribution( repo, '../../packages/source/p/pkgsync/pkgsync-0.1.0.zip#md5=%s' % self.empty_digest, 'pkgsync', ) self.assertEqual(RemoteDistribution.diff([zip_d, tgz_d], [tgz_d]), [zip_d])
def test_empty_diff(self): self.assertEqual(RemoteDistribution.diff([], []), [])