Esempio n. 1
0
    def test_ban_list(self):
        '''
        Test to list varnish cache current bans
        '''
        with patch.object(varnish, '_run_varnishadm',
                          return_value={'retcode': True}):
            self.assertFalse(varnish.ban_list())

        with patch.object(varnish, '_run_varnishadm',
                          return_value={'retcode': False,
                                        'stdout': 'A\nB\nC'}):
            self.assertEqual(varnish.ban_list(), ['B', 'C'])
Esempio n. 2
0
    def test_ban_list(self):
        """
        Test to list varnish cache current bans
        """
        with patch.object(varnish, "_run_varnishadm", return_value={"retcode": True}):
            self.assertFalse(varnish.ban_list())

        with patch.object(
            varnish,
            "_run_varnishadm",
            return_value={"retcode": False, "stdout": "A\nB\nC"},
        ):
            self.assertEqual(varnish.ban_list(), ["B", "C"])