Ejemplo n.º 1
0
    def test_absent(self):
        """
        Test to ensure a Linux ACL does not exist
        """
        name = "/root"
        acl_type = "users"
        acl_name = "damian"
        perms = "rwx"

        ret = {"name": name, "result": None, "comment": "", "changes": {}}

        mock = MagicMock(
            side_effect=[
                {name: {acl_type: [{acl_name: {"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.absent(name, acl_type, acl_name, perms), ret
                )

            comt = "ACL Type does not exist"
            ret.update({"comment": comt, "result": False})
            self.assertDictEqual(linux_acl.absent(name, acl_type, acl_name, perms), ret)
Ejemplo n.º 2
0
    def test_absent(self):
        '''
        Test to ensure a Linux ACL does not exist
        '''
        name = '/root'
        acl_type = 'users'
        acl_name = 'damian'
        perms = 'rwx'

        ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

        mock = MagicMock(side_effect=[{
            name: {
                acl_type: [{
                    acl_name: {
                        '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.absent(name, acl_type, acl_name, perms), ret)

            comt = ('ACL Type does not exist')
            ret.update({'comment': comt, 'result': False})
            self.assertDictEqual(
                linux_acl.absent(name, acl_type, acl_name, perms), ret)
Ejemplo n.º 3
0
    def test_absent(self):
        '''
        Test to ensure a Linux ACL does not exist
        '''
        name = '/root'
        acl_type = 'users'
        acl_name = 'damian'
        perms = 'rwx'

        ret = {'name': name,
               'result': None,
               'comment': '',
               'changes': {}}

        mock = MagicMock(side_effect=[{name: {acl_type: [{acl_name:
                                                          {'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.absent(name, acl_type, acl_name,
                                                      perms), ret)

            comt = ('ACL Type does not exist')
            ret.update({'comment': comt, 'result': False})
            self.assertDictEqual(linux_acl.absent(name, acl_type, acl_name,
                                                  perms), ret)