def test_record_traceback(self): callback = mock.Mock() with CacheRecorder("default", callback): caches["default"].get("foo") assert len(callback.mock_calls) == 1 assert "django_perf_rec/cache.py" in str( callback.call_args_list[0][0][0].traceback)
def test_secondary_default_not_recorded(self): callback = mock.Mock() with CacheRecorder('second', callback): caches['default'].get('foo') assert len(callback.mock_calls) == 0
def test_secondary(self): callback = mock.Mock() with CacheRecorder('second', callback): caches['second'].get('foo') callback.assert_called_once_with(CacheOp('second', 'get', 'foo'), )
def test_default(self): callback = mock.Mock() with CacheRecorder('default', callback): caches['default'].get('foo') callback.assert_called_once_with(CacheOp('default', 'get', 'foo'), )
def test_secondary_default_not_recorded(self): callback = mock.Mock() with CacheRecorder("second", callback): caches["default"].get("foo") assert len(callback.mock_calls) == 0
def test_secondary(self): callback = mock.Mock() with CacheRecorder("second", callback): caches["second"].get("foo") callback.assert_called_once_with(CacheOp("second", "get", "foo"))
def test_default(self): callback = mock.Mock() with CacheRecorder("default", callback): caches["default"].get("foo") callback.assert_called_once_with(CacheOp("default", "get", "foo"))