def test_increment(self):
        class MockMemcache(object):
            """
            Mock of memcache
            """
            def __init__(self):
                self.key = None

            @staticmethod
            def get_stats():
                """
                Mock of stats method
                """
                return [('127.0.0.1:11211 (1)', {})]

            def get(self, key):
                """
                Mock of get method
                """
                self.key = key
                return 1

            def incr(self, key, delta):
                """
                Mock of incr method
                """
                self.key = key
                if not isinstance(delta, integer_types):
                    raise SaltInvocationError('Delta value must be an integer')
                return key

        with patch.object(memcached, '_connect',
                          MagicMock(return_value=MockMemcache())):
            self.assertEqual(memcached.increment('salt'), 'salt')

            self.assertRaises(SaltInvocationError, memcached.increment,
                              'salt', delta='sa')
Fetch a single Plugin.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/memcached_test.py/MemcachedTestCase.test_increment--crossover with--dataset/ETHPy150Open ducksboard/libsaas/libsaas/services/newrelic/plugins.py/Plugin.get