def test_update_cache(self):
        get_mock.reset_mock()
        model = CachingPynamoModel({})
        CachingPynamoModel.cache = TTLCache(maxsize=128, ttl=0.001)

        key = [random_key(), random_key()]

        model._get_keys = MagicMock(return_value=key)

        model.update(actions=[])

        item = model.get(*key)

        self.assertEqual(item, model)

        get_mock.assert_not_called()
    def test_delete_cache(self):
        get_mock.reset_mock()
        model = CachingPynamoModel({})
        CachingPynamoModel.cache = TTLCache(maxsize=128, ttl=0.001)

        key = [random_key(), random_key()]

        model._get_keys = MagicMock(return_value=key)

        model.save()

        item = model.get(*key)

        self.assertEqual(item, model)

        get_mock.assert_not_called()

        model.delete()

        item = model.get(*key)

        self.assertEqual(item, get_mock_result)

        get_mock.assert_called_once()