def test_list_absent(self): ''' Test to ensure a Linux ACL does not exist ''' name = '/root' acl_type = 'users' acl_names = ['damian', 'homer'] perms = 'rwx' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} mock = MagicMock(side_effect=[{name: {acl_type: [{acl_names[0]: {'octal': 'A'}, acl_names[1]: {'octal': 'A'}}]}}, {name: {acl_type: ''}}]) with patch.dict(linux_acl.__salt__, {'acl.getfacl': mock}): with patch.dict(linux_acl.__opts__, {'test': True}): comt = ('Removing permissions') ret.update({'comment': comt}) self.assertDictEqual(linux_acl.list_absent(name, acl_type, acl_names, perms), ret) comt = ('ACL Type does not exist') ret.update({'comment': comt, 'result': False}) self.assertDictEqual(linux_acl.list_absent(name, acl_type, acl_names), ret)
def test_list_absent(self): """ Test to ensure a Linux ACL does not exist """ name = "/root" acl_type = "users" acl_names = ["damian", "homer"] perms = "rwx" ret = {"name": name, "result": None, "comment": "", "changes": {}} mock = MagicMock( side_effect=[ { name: { acl_type: [ {acl_names[0]: {"octal": "A"}, acl_names[1]: {"octal": "A"}} ] } }, {name: {acl_type: ""}}, ] ) with patch.dict(linux_acl.__salt__, {"acl.getfacl": mock}): with patch.dict(linux_acl.__opts__, {"test": True}): comt = "Removing permissions" ret.update({"comment": comt}) self.assertDictEqual( linux_acl.list_absent(name, acl_type, acl_names, perms), ret ) comt = "ACL Type does not exist" ret.update({"comment": comt, "result": False}) self.assertDictEqual(linux_acl.list_absent(name, acl_type, acl_names), ret)