Пример #1
0
    def test_cache_put(self, CacheEntry, CacheStats):
        store = MagicMock()

        c = Cache(store=MagicMock(return_value=store))
        c.put('foo', 'Value Of Foo', new=True)

        CacheEntry.assert_called_once_with('Value Of Foo')

        store.__setitem__.assert_called_once_with('foo',
            CacheEntry.return_value)
        CacheStats.return_value.put.assert_called_once_with(new=True)
Пример #2
0
    def test_cache_put(self, CacheEntry, CacheStats):
        store = MagicMock()

        c = Cache(store=MagicMock(return_value=store))
        c.put('foo', 'Value Of Foo', new=True)

        CacheEntry.assert_called_once_with('Value Of Foo')

        store.__setitem__.assert_called_once_with('foo',
            CacheEntry.return_value)
        CacheStats.return_value.put.assert_called_once_with(new=True)