Ejemplo n.º 1
0
def test_recover_all():
    """
    Test for set the all the workers in lbn to recover and
    activate them if they are not
    """
    with patch.object(modjk, "_do_http", return_value={}):
        assert modjk.recover_all("loadbalancer1") == {}

    with patch.object(
            modjk,
            "_do_http",
            return_value={"worker.loadbalancer1.balance_workers": "SALT"},
    ):
        with patch.object(
                modjk,
                "worker_status",
                return_value={
                    "activation": "ACT",
                    "state": "OK"
                },
        ):
            assert modjk.recover_all("loadbalancer1") == {
                "SALT": {
                    "activation": "ACT",
                    "state": "OK"
                }
            }
Ejemplo n.º 2
0
    def test_recover_all(self):
        '''
        Test for set the all the workers in lbn to recover and
        activate them if they are not
        '''
        with patch.object(modjk, '_do_http', return_value={}):
            self.assertDictEqual(modjk.recover_all('loadbalancer1'), {})

        with patch.object(modjk, '_do_http', return_value=
                          {'worker.loadbalancer1.balance_workers': 'SALT'}):
            with patch.object(modjk, 'worker_status',
                              return_value={'activation': 'ACT',
                                            'state': 'OK'}):
                self.assertDictEqual(modjk.recover_all('loadbalancer1'),
                                     {'SALT': {'activation': 'ACT',
                                               'state': 'OK'}})
Ejemplo n.º 3
0
    def test_recover_all(self):
        '''
        Test for set the all the workers in lbn to recover and
        activate them if they are not
        '''
        with patch.object(modjk, '_do_http', return_value={}):
            self.assertDictEqual(modjk.recover_all('loadbalancer1'), {})

        with patch.object(modjk, '_do_http', return_value=
                          {'worker.loadbalancer1.balance_workers': 'SALT'}):
            with patch.object(modjk, 'worker_status',
                              return_value={'activation': 'ACT',
                                            'state': 'OK'}):
                self.assertDictEqual(modjk.recover_all('loadbalancer1'),
                                     {'SALT': {'activation': 'ACT',
                                               'state': 'OK'}})