def test_cache_metadata(config_stub, tmpdir):
 config_stub.data = {'storage': {'cache-size': 1024}, 'general': {'private-browsing': False}}
 url = 'http://qutebrowser.org'
 metadata = QNetworkCacheMetaData()
 metadata.setUrl(QUrl(url))
 assert metadata.isValid()
 disk_cache = cache.DiskCache(str(tmpdir))
 device = disk_cache.prepare(metadata)
 device.write('foobar')
 disk_cache.insert(device)
 assert (disk_cache.metaData(QUrl(url)) == metadata)

def test_cache_metadata ( config_stub , tmpdir ) : config_stub . data = { 'storage' : { 'cache-size' : 1024 } , 'general' : { 'private-browsing' : False } } url = 'http://qutebrowser.org' metadata = QNetworkCacheMetaData ( ) metadata . setUrl ( QUrl ( url ) ) assert metadata . isValid ( ) disk_cache = cache . DiskCache ( str ( tmpdir ) ) device = disk_cache . prepare ( metadata ) device . write ( 'foobar' ) disk_cache . insert ( device ) assert ( disk_cache . metaData ( QUrl ( url ) ) == metadata )
ensure that diskcache .