def test_cache_deactivated_insert_data(config_stub, tmpdir):
 url = 'http://qutebrowser.org'
 disk_cache = QNetworkDiskCache()
 disk_cache.setCacheDirectory(str(tmpdir))
 metadata = QNetworkCacheMetaData()
 metadata.setUrl(QUrl(url))
 device = disk_cache.prepare(metadata)
 assert (device is not None)
 config_stub.data = {'storage': {'cache-size': 1024}, 'general': {'private-browsing': True}}
 deactivated_cache = cache.DiskCache(str(tmpdir))
 assert (deactivated_cache.insert(device) is None)

def test_cache_deactivated_insert_data ( config_stub , tmpdir ) : url = 'http://qutebrowser.org' disk_cache = QNetworkDiskCache ( ) disk_cache . setCacheDirectory ( str ( tmpdir ) ) metadata = QNetworkCacheMetaData ( ) metadata . setUrl ( QUrl ( url ) ) device = disk_cache . prepare ( metadata ) assert ( device is not None ) config_stub . data = { 'storage' : { 'cache-size' : 1024 } , 'general' : { 'private-browsing' : True } } deactivated_cache = cache . DiskCache ( str ( tmpdir ) ) assert ( deactivated_cache . insert ( device ) is None )
insert data when cache is deactivated .