Ejemplo n.º 1
0
    def test_status_false(self):
        '''
        Test if it gets memcached status
        '''
        class MockMemcache(object):
            """
            Mock of memcache
            """
            @staticmethod
            def get_stats():
                """
                Mock of stats method
                """
                return []

        with patch.object(memcached, '_connect',
                          MagicMock(return_value=MockMemcache())):
            self.assertFalse(memcached.status())
Ejemplo n.º 2
0
    def test_status(self):
        '''
        Test if it gets memcached status
        '''
        class MockMemcache(object):
            """
            Mock of memcache
            """
            @staticmethod
            def get_stats():
                """
                Mock of stats method
                """
                return [('127.0.0.1:11211 (1)', {})]

        with patch.object(memcached, '_connect',
                          MagicMock(return_value=MockMemcache())):
            self.assertDictEqual(memcached.status(),
                                 {'127.0.0.1:11211 (1)': {}})
Ejemplo n.º 3
0
    def test_status(self):
        '''
        Test if it gets memcached status
        '''
        class MockMemcache(object):
            """
            Mock of memcache
            """
            @staticmethod
            def get_stats():
                """
                Mock of stats method
                """
                return [('127.0.0.1:11211 (1)', {})]

        with patch.object(memcached, '_connect',
                          MagicMock(return_value=MockMemcache())):
            self.assertDictEqual(memcached.status(),
                                 {'127.0.0.1:11211 (1)': {}})
Ejemplo n.º 4
0
    def test_status_false(self):
        """
        Test if it gets memcached status
        """

        class MockMemcache(object):
            """
            Mock of memcache
            """

            @staticmethod
            def get_stats():
                """
                Mock of stats method
                """
                return []

        with patch.object(
            memcached, "_connect", MagicMock(return_value=MockMemcache())
        ):
            self.assertFalse(memcached.status())