def test_edited_conf(): """ Test to edit LXC configuration options """ name = "web01" comment = "{} lxc.conf will be edited".format(name) ret = {"name": name, "result": True, "comment": comment, "changes": {}} with patch.object(salt.utils.versions, "warn_until", MagicMock()): with patch.dict(lxc.__opts__, {"test": True}): assert lxc.edited_conf(name) == ret with patch.dict(lxc.__opts__, {"test": False}): mock = MagicMock(return_value={}) with patch.dict(lxc.__salt__, {"lxc.update_lxc_conf": mock}): assert lxc.edited_conf(name) == {"name": "web01"}
def test_edited_conf(self): ''' Test to edit LXC configuration options ''' name = 'web01' comment = ('{0} lxc.conf will be edited'.format(name)) ret = {'name': name, 'result': True, 'comment': comment, 'changes': {}} with patch.object(salt.utils, 'warn_until', MagicMock()): with patch.dict(lxc.__opts__, {'test': True}): self.assertDictEqual(lxc.edited_conf(name), ret) with patch.dict(lxc.__opts__, {'test': False}): mock = MagicMock(return_value={}) with patch.dict(lxc.__salt__, {'lxc.update_lxc_conf': mock}): self.assertDictEqual(lxc.edited_conf(name), {'name': 'web01'})