def test_shortcut_checks_when_one_fails(self):
        c1 = mock_condition(return_value=False, str='Condition(1)')
        c2 = mock_condition(str='Condition(2)')
        o = DataEndpoint()
        o.add_condition(c1)
        o.add_condition(c2)

        result, reason = o._check_conditions(value=3)

        assert not result
        assert reason == 'Condition(1)'

        c1.check.assert_called_once_with(value=3)
        assert c2.check.call_count == 0
        assert not c1.update.called
        assert not c2.update.called
    def test_all_conditions_checked(self):
        c1 = mock_condition(str='Condition(1)')
        c2 = mock_condition(str='Condition(2)')
        o = DataEndpoint()
        o.add_condition(c1)
        o.add_condition(c2)

        result, reason = o._check_conditions(value=1)

        assert result
        assert not reason

        c1.check.assert_called_once_with(value=1)
        c2.check.assert_called_once_with(value=1)
        assert not c1.update.called
        assert not c2.update.called