def test_disappeared_repo_sdp_not_cached(self): self.rapid.packages.load() self.setUp() # re-initialise self.downloader.www[master_url] = gzip_string('') p = self.rapid.packages['xta:latest'] self.assertFalse(p.installable) self.assertRaises(OfflineRepositoryException, lambda: p.files)
def test_installable_all_cached(self): p = self.rapid.packages['dependency'] p.install() p.uninstall() self.setUp() # re-initialise self.downloader.www[master_url] = gzip_string('') p = self.rapid.packages['dependency'] self.assertTrue(p.installable)
def test_detached_package_repair(self): self.rapid.packages['dependency'].files self.setUp() # re-initialise self.downloader.www['http://ts1/versions.gz'] = gzip_string('') p = self.rapid.packages['dependency'] self.assertTrue(p.repository) self.assertTrue(hasattr(p, 'cache_file')) self.assertTrue(p.available) self.assertTrue(p.installable) p.files
def test_detached_package(self): self.rapid.packages.load() self.setUp() # re-initialise self.downloader.www['http://ts1/versions.gz'] = gzip_string('') p = self.rapid.packages['dependency'] self.assertFalse(p.repository) self.assertFalse(hasattr(p, 'cache_file')) self.assertFalse(p.available) self.assertFalse(p.installable) self.assertRaises(DetachedPackageException, lambda: p.files) self.assertRaises(DetachedPackageException, lambda: p.install())
def setUp(self): set_spring_dir(self.test_dir) # Speed up the test because if pool is present the 256 pool # directories are created on demand instead of beforehand. mkdir_p(rapid.pool_dir) if True: # False to use real Downloader, True to use MockDownloader self.downloader = MockDownloader() self.rapid = Rapid(self.downloader) www = self.downloader.www www[master_url] = gzip_string(',http://ts1,,\n') # The last two packages have an identical name. This should not # actually happen in practice (leaves no good way to normalize # versions.gz), though it did happen once. (#9) # So it's present here to test that rapid handles it properly. www['http://ts1/versions.gz'] = gzip_string('xta:latest,1234,dependency,XTA 9.6\n,5678,,dependency\n,90AB,,dependency\n') www['http://ts1/packages/1234.sdp'] = gzip_string('\3foo' + binascii.unhexlify('d41d8cd98f00b204e9800998ecf8427e') + 8 * '\0') www['http://ts1/packages/5678.sdp'] = gzip_string('') www['http://ts1/packages/90AB.sdp'] = gzip_string('') www['http://ts1/streamer.cgi?1234'] = struct.pack('>L', len(gzip_string(''))) + gzip_string('') else: self.downloader = Downloader() self.rapid = Rapid(self.downloader)
def test_disappeared_repo_sdp_cached(self): self.rapid.packages['xta:latest'].files self.setUp() # re-initialise self.downloader.www[master_url] = gzip_string('') p = self.rapid.packages['xta:latest'] p.files