コード例 #1
0
    def test_absent(self):
        '''
        Test to ensure the named Rackspace queue is deleted.
        '''
        name = 'myqueue'
        provider = 'my-pyrax'

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

        mock_dct = MagicMock(side_effect=[{
            provider: {
                'salt': False
            }
        }, {
            provider: {
                'salt': True
            }
        }])
        with patch.dict(pyrax_queues.__salt__, {'cloud.action': mock_dct}):
            comt = ('myqueue does not exist.')
            ret.update({'comment': comt})
            self.assertDictEqual(pyrax_queues.absent(name, provider), ret)

            with patch.dict(pyrax_queues.__opts__, {'test': True}):
                comt = ('Rackspace queue myqueue is set to be removed.')
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(pyrax_queues.absent(name, provider), ret)
コード例 #2
0
def test_absent():
    """
    Test to ensure the named Rackspace queue is deleted.
    """
    name = "myqueue"
    provider = "my-pyrax"

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

    mock_dct = MagicMock(side_effect=[{
        provider: {
            "salt": False
        }
    }, {
        provider: {
            "salt": True
        }
    }])
    with patch.dict(pyrax_queues.__salt__, {"cloud.action": mock_dct}):
        comt = "myqueue does not exist."
        ret.update({"comment": comt})
        assert pyrax_queues.absent(name, provider) == ret

        with patch.dict(pyrax_queues.__opts__, {"test": True}):
            comt = "Rackspace queue myqueue is set to be removed."
            ret.update({"comment": comt, "result": None})
            assert pyrax_queues.absent(name, provider) == ret
コード例 #3
0
ファイル: pyrax_queues_test.py プロジェクト: DaveQB/salt
    def test_absent(self):
        '''
        Test to ensure the named Rackspace queue is deleted.
        '''
        name = 'myqueue'
        provider = 'my-pyrax'

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

        mock_dct = MagicMock(side_effect=[{provider: {'salt': False}},
                                          {provider: {'salt': True}}])
        with patch.dict(pyrax_queues.__salt__, {'cloud.action': mock_dct}):
            comt = ('myqueue does not exist.')
            ret.update({'comment': comt})
            self.assertDictEqual(pyrax_queues.absent(name, provider), ret)

            with patch.dict(pyrax_queues.__opts__, {'test': True}):
                comt = ('Rackspace queue myqueue is set to be removed.')
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(pyrax_queues.absent(name, provider), ret)