def test_should_return_None_when_exception_raised(self, _):

        failure = Failure(RuntimeError())
        failure.lb_ip = '192.168.0.1'
        responses = [(True, {'name': 'devytc97', 'state': 'up', 'session': 'monitor-enabled'}),
                     (False, failure)]

        self.assertEquals(None, check_status_responses(responses))
    def test_should_return_3_when_node_is_disabled(self):
        responses = [(True, {
            'name': 'devytc97',
            'state': 'user-down',
            'session': 'user-disabled'
        })]

        self.assertEquals(3, check_status_responses(responses))
    def test_should_return_0_when_node_is_enabled(self):
        responses = [(True, {
            'name': 'devytc97',
            'state': 'up',
            'session': 'monitor-enabled'
        })]

        self.assertEquals(0, check_status_responses(responses))
    def test_should_return_None_when_node_is_inconsistent(self):
        responses = [(True, {
            'name': 'devytc97',
            'state': 'up',
            'session': 'user-disabled',
            'lb_ip': 'some-lb'
        })]

        self.assertEquals(None, check_status_responses(responses))
    def test_should_return_None_when_exception_raised(self, _):

        failure = Failure(RuntimeError())
        failure.lb_ip = '192.168.0.1'
        responses = [(True, {
            'name': 'devytc97',
            'state': 'up',
            'session': 'monitor-enabled'
        }), (False, failure)]

        self.assertEquals(None, check_status_responses(responses))
    def test_should_return_None_when_node_is_inconsisten_on_one_lb(self):
        responses = [(True, {'name': 'devytc97', 'state': 'up', 'session': 'monitor-enabled', 'lb_ip': 'some-lb'}),
                     (True, {'name': 'devytc98', 'state': 'up', 'session': 'user-disabled', 'lb_ip': 'some-lb'})]

        self.assertEquals(None, check_status_responses(responses))
    def test_should_return_3_when_node_is_disabled_on_all_lbs(self):
        responses = [(True, {'name': 'devytc97', 'state': 'user-down', 'session': 'user-disabled'}),
                     (True, {'name': 'devytc98', 'state': 'user-down', 'session': 'user-disabled'})]

        self.assertEquals(3, check_status_responses(responses))
    def test_should_return_0_when_node_is_enabled_on_all_lbs(self):
        responses = [(True, {'name': 'devytc97', 'state': 'up', 'session': 'monitor-enabled'}),
                     (True, {'name': 'devytc98', 'state': 'up', 'session': 'monitor-enabled'})]

        self.assertEquals(0, check_status_responses(responses))
    def test_should_return_None_when_exception_raised(self, _):
        failure = Failure(RuntimeError())
        failure.lb_ip = '192.168.0.1'
        responses = [(False, failure)]

        self.assertEquals(None, check_status_responses(responses))
    def test_should_return_None_when_exception_raised(self, _):
        failure = Failure(RuntimeError())
        failure.lb_ip = '192.168.0.1'
        responses = [(False, failure)]

        self.assertEquals(None, check_status_responses(responses))