Esempio n. 1
0
def test_get_pillar_errors_CE():
    """
    Test _get_pillar_errors function.
    CC: External clean, Internal erroneous
    :return:
    """
    errors = ["failure", "everywhere"]
    for int_pillar, ext_pillar in [
        ({
            "foo": "bar",
            "_errors": errors
        }, {
            "fred": "baz"
        }),
        ({
            "foo": "bar",
            "_errors": errors
        }, None),
    ]:
        with patch("salt.modules.state.__pillar__", int_pillar):
            for opts, res in [
                ({
                    "force": True
                }, None),
                ({
                    "force": False
                }, errors),
                ({}, errors),
            ]:
                assert res == state._get_pillar_errors(kwargs=opts,
                                                       pillar=ext_pillar)
Esempio n. 2
0
def test_get_pillar_errors_CC():
    """
    Test _get_pillar_errors function.
    CC: External clean, Internal clean
    :return:
    """
    for int_pillar, ext_pillar in [
        ({
            "foo": "bar"
        }, {
            "fred": "baz"
        }),
        ({
            "foo": "bar"
        }, None),
        ({}, {
            "fred": "baz"
        }),
    ]:
        with patch("salt.modules.state.__pillar__", int_pillar):
            for opts, res in [
                ({
                    "force": True
                }, None),
                ({
                    "force": False
                }, None),
                ({}, None),
            ]:
                assert res == state._get_pillar_errors(kwargs=opts,
                                                       pillar=ext_pillar)
Esempio n. 3
0
 def test_get_pillar_errors_EE(self):
     '''
     Test _get_pillar_errors function.
     CC: External erroneous, Internal erroneous
     :return:
     '''
     errors = ['failure', 'everywhere']
     for int_pillar, ext_pillar in [({
             'foo': 'bar',
             '_errors': errors
     }, {
             'fred': 'baz',
             '_errors': errors
     })]:
         with patch('salt.modules.state.__pillar__', int_pillar):
             for opts, res in [({
                     'force': True
             }, None), ({
                     'force': False
             }, errors), ({}, errors)]:
                 assert res == state._get_pillar_errors(kwargs=opts,
                                                        pillar=ext_pillar)
Esempio n. 4
0
 def test_get_pillar_errors_CC(self):
     '''
     Test _get_pillar_errors function.
     CC: External clean, Internal clean
     :return:
     '''
     for int_pillar, ext_pillar in [({
             'foo': 'bar'
     }, {
             'fred': 'baz'
     }), ({
             'foo': 'bar'
     }, None), ({}, {
             'fred': 'baz'
     })]:
         with patch('salt.modules.state.__pillar__', int_pillar):
             for opts, res in [({
                     'force': True
             }, None), ({
                     'force': False
             }, None), ({}, None)]:
                 assert res == state._get_pillar_errors(kwargs=opts,
                                                        pillar=ext_pillar)