Beispiel #1
0
def test_config_present_does_not_exist():
    """
    Test salt.states.smartos.config_present
    when the config files does not exist
    """
    name = "test"
    value = "test_value"
    with patch("os.path.isfile", return_value=False):
        with patch("salt.utils.atomicfile.atomic_open", side_effect=IOError):
            ret = smartos.config_present(name=name, value=value)
    assert not ret["result"]
    assert ret[
        "comment"] == 'Could not add property {} with value "{}" to config'.format(
            name, value)
Beispiel #2
0
 def test_config_present_does_not_exist(self):
     '''
     Test salt.states.smartos.config_present
     when the config files does not exist
     '''
     name = 'test'
     value = 'test_value'
     with patch('os.path.isfile', return_value=False):
         with patch('salt.utils.atomicfile.atomic_open',
                    side_effect=IOError):
             ret = smartos.config_present(name=name, value=value)
     assert not ret['result']
     assert ret[
         'comment'] == 'Could not add property {0} with value "{1}" to config'.format(
             name, value)