def test_expire_not_expired(self, foo): filename = 'somefile' # make sure os.remove was not called with patch('franck.io.cache.os.remove') as m: _expire(filename) self.assertEqual(len(m.mock_calls), 0)
def test_expire_expired(self, foo): filename = 'somefile' path = os.path.join(CACHEDIR, filename) # make sure os.remove was called on the cached file with patch('franck.io.cache.os.remove') as m: _expire(filename) m.assert_called_once_with(path)