コード例 #1
0
ファイル: keystone_test.py プロジェクト: lvg01/salt.old
    def test_endpoint_absent(self):
        '''
        Test to ensure that the endpoint for a service doesn't
         exist in Keystone catalog
        '''
        name = 'nova'
        comment = ('endpoint for service "{0}" is already absent'.format(name))
        ret = {'name': name, 'changes': {}, 'result': True, 'comment': comment}

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

            with patch.dict(keystone.__opts__, {'test': True}):
                comt = (
                    'Endpoint for service "{0}" will be deleted'.format(name))
                ret.update({
                    'comment': comt,
                    'result': None,
                    'changes': {
                        'endpoint': 'Will be deleted'
                    }
                })
                self.assertDictEqual(keystone.endpoint_absent(name), ret)
コード例 #2
0
ファイル: keystone_test.py プロジェクト: DaveQB/salt
    def test_endpoint_absent(self):
        """
        Test to ensure that the endpoint for a service doesn't
         exist in Keystone catalog
        """
        name = "nova"
        comment = 'endpoint for service "{0}" is already absent'.format(name)
        ret = {"name": name, "changes": {}, "result": True, "comment": comment}

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

            with patch.dict(keystone.__opts__, {"test": True}):
                comt = 'Endpoint for service "{0}" will be deleted'.format(name)
                ret.update({"comment": comt, "result": None, "changes": {"endpoint": "Will be deleted"}})
                self.assertDictEqual(keystone.endpoint_absent(name), ret)
コード例 #3
0
    def test_endpoint_absent(self):
        """
        Test to ensure that the endpoint for a service doesn't
         exist in Keystone catalog
        """
        name = "nova"
        region = "RegionOne"
        comment = 'Endpoint for service "{}" is already absent'.format(name)
        ret = {"name": name, "changes": {}, "result": True, "comment": comment}

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

            with patch.dict(keystone.__opts__, {"test": True}):
                comt = 'Endpoint for service "{}" will be deleted'.format(name)
                ret.update({"comment": comt, "result": None})
                self.assertDictEqual(keystone.endpoint_absent(name, region), ret)
コード例 #4
0
ファイル: keystone_test.py プロジェクト: bryson/salt
    def test_endpoint_absent(self):
        '''
        Test to ensure that the endpoint for a service doesn't
         exist in Keystone catalog
        '''
        name = 'nova'
        comment = ('Endpoint for service "{0}" is already absent'.format(name))
        ret = {'name': name,
               'changes': {},
               'result': True,
               'comment': comment}

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

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