Beispiel #1
0
    def test_present(self):
        '''
        Test to ensure the user exists on the Dell DRAC
        '''
        name = 'damian'
        password = '******'
        permission = 'login,test_alerts,clear_logs'

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

        mock = MagicMock(return_value=[name])
        with patch.dict(drac.__salt__, {'drac.list_users': mock}):
            with patch.dict(drac.__opts__, {'test': True}):
                comt = ('`{0}` already exists'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(drac.present(name, password, permission),
                                     ret)

            with patch.dict(drac.__opts__, {'test': False}):
                comt = ('`{0}` already exists'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(drac.present(name, password, permission),
                                     ret)
Beispiel #2
0
    def test_present(self):
        '''
        Test to ensure the user exists on the Dell DRAC
        '''
        name = 'damian'
        password = '******'
        permission = 'login,test_alerts,clear_logs'

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

        mock = MagicMock(return_value=[name])
        with patch.dict(drac.__salt__, {'drac.list_users': mock}):
            with patch.dict(drac.__opts__, {'test': True}):
                comt = ('`{0}` already exists'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(drac.present(name, password, permission),
                                     ret)

            with patch.dict(drac.__opts__, {'test': False}):
                comt = ('`{0}` already exists'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(drac.present(name, password, permission),
                                     ret)
Beispiel #3
0
    def test_present(self):
        """
        Test to ensure the user exists on the Dell DRAC
        """
        name = "damian"
        password = "******"
        permission = "login,test_alerts,clear_logs"

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

        mock = MagicMock(return_value=[name])
        with patch.dict(drac.__salt__, {"drac.list_users": mock}):
            with patch.dict(drac.__opts__, {"test": True}):
                comt = "`{0}` already exists".format(name)
                ret.update({"comment": comt})
                self.assertDictEqual(drac.present(name, password, permission), ret)

            with patch.dict(drac.__opts__, {"test": False}):
                comt = "`{0}` already exists".format(name)
                ret.update({"comment": comt})
                self.assertDictEqual(drac.present(name, password, permission), ret)