Exemple #1
0
 def test_get_url_no_save(self, _):
     """ Calls to get_url() doesn't save if autocommit=False """
     cache = ICache(MagicMock())
     cache.autocommit = False
     with patch.object(cache, 'save') as save:
         package = make_package()
         cache.get_url(package)
         self.assertFalse(save.called)
Exemple #2
0
 def test_get_url_no_save(self, _):
     """ Calls to get_url() doesn't save if autocommit=False """
     cache = ICache(MagicMock())
     cache.autocommit = False
     with patch.object(cache, 'save') as save:
         package = make_package()
         cache.get_url(package)
         self.assertFalse(save.called)
Exemple #3
0
 def test_get_url_saves(self, _):
     """ Calls to get_url() saves to caching db if autocommit=True """
     cache = ICache(MagicMock())
     with patch.object(cache, 'save') as save:
         cache.autocommit = True
         package = make_package()
         cache.get_url(package)
         save.assert_called_with(package)
Exemple #4
0
 def test_get_url_saves(self, _):
     """ Calls to get_url() saves to caching db if autocommit=True """
     cache = ICache(MagicMock())
     with patch.object(cache, 'save') as save:
         cache.autocommit = True
         package = make_package()
         cache.get_url(package)
         save.assert_called_with(package)