Ejemplo n.º 1
0
    def test_user_absent(self):
        '''
        Test to ensure that the keystone user is absent.
        '''
        name = 'nova'

        ret = {
            'name': name,
            'changes': {},
            'result': True,
            'comment': 'User "{0}" is already absent'.format(name)
        }

        mock_lst = MagicMock(side_effect=[['Error'], []])
        with patch.dict(keystone.__salt__, {'keystone.user_get': mock_lst}):
            self.assertDictEqual(keystone.user_absent(name), ret)

            with patch.dict(keystone.__opts__, {'test': True}):
                comt = ('User "{0}" will be deleted'.format(name))
                ret.update({
                    'comment': comt,
                    'result': None,
                    'changes': {
                        'User': '******'
                    }
                })
                self.assertDictEqual(keystone.user_absent(name), ret)
Ejemplo n.º 2
0
    def test_user_absent(self):
        """
        Test to ensure that the keystone user is absent.
        """
        name = "nova"

        ret = {"name": name, "changes": {}, "result": True, "comment": 'User "{0}" is already absent'.format(name)}

        mock_lst = MagicMock(side_effect=[["Error"], []])
        with patch.dict(keystone.__salt__, {"keystone.user_get": mock_lst}):
            self.assertDictEqual(keystone.user_absent(name), ret)

            with patch.dict(keystone.__opts__, {"test": True}):
                comt = 'User "{0}" will be deleted'.format(name)
                ret.update({"comment": comt, "result": None, "changes": {"User": "******"}})
                self.assertDictEqual(keystone.user_absent(name), ret)
Ejemplo n.º 3
0
    def test_user_absent(self):
        '''
        Test to ensure that the keystone user is absent.
        '''
        name = 'nova'

        ret = {'name': name,
               'changes': {},
               'result': True,
               'comment': 'User "{0}" is already absent'.format(name)}

        mock_lst = MagicMock(side_effect=[['Error'], []])
        with patch.dict(keystone.__salt__, {'keystone.user_get': mock_lst}):
            self.assertDictEqual(keystone.user_absent(name), ret)

            with patch.dict(keystone.__opts__, {'test': True}):
                comt = 'User "{0}" will be deleted'.format(name)
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(keystone.user_absent(name), ret)
Ejemplo n.º 4
0
    def test_user_absent(self):
        """
        Test to ensure that the keystone user is absent.
        """
        name = "nova"

        ret = {
            "name": name,
            "changes": {},
            "result": True,
            "comment": 'User "{}" is already absent'.format(name),
        }

        mock_lst = MagicMock(side_effect=[["Error"], []])
        with patch.dict(keystone.__salt__, {"keystone.user_get": mock_lst}):
            self.assertDictEqual(keystone.user_absent(name), ret)

            with patch.dict(keystone.__opts__, {"test": True}):
                comt = 'User "{}" will be deleted'.format(name)
                ret.update({"comment": comt, "result": None})
                self.assertDictEqual(keystone.user_absent(name), ret)