コード例 #1
0
ファイル: test_layman.py プロジェクト: nicholasmhughes/salt
def test_absent():
    """
    Test to verify that the overlay is absent.
    """
    name = "sunrise"

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

    mock = MagicMock(side_effect=[[], [name]])
    with patch.dict(layman.__salt__, {"layman.list_local": mock}):
        comt = "Overlay {} already absent".format(name)
        ret.update({"comment": comt})
        assert layman.absent(name) == ret

        with patch.dict(layman.__opts__, {"test": True}):
            comt = "Overlay {} is set to be deleted".format(name)
            ret.update({"comment": comt, "result": None})
            assert layman.absent(name) == ret
コード例 #2
0
ファイル: test_layman.py プロジェクト: vindir/salt
    def test_absent(self):
        '''
        Test to verify that the overlay is absent.
        '''
        name = 'sunrise'

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

        mock = MagicMock(side_effect=[[], [name]])
        with patch.dict(layman.__salt__, {'layman.list_local': mock}):
            comt = ('Overlay {0} already absent'.format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(layman.absent(name), ret)

            with patch.dict(layman.__opts__, {'test': True}):
                comt = ('Overlay {0} is set to be deleted'.format(name))
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(layman.absent(name), ret)
コード例 #3
0
ファイル: layman_test.py プロジェクト: bryson/salt
    def test_absent(self):
        """
        Test to verify that the overlay is absent.
        """
        name = "sunrise"

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

        mock = MagicMock(side_effect=[[], [name]])
        with patch.dict(layman.__salt__, {"layman.list_local": mock}):
            comt = "Overlay {0} already absent".format(name)
            ret.update({"comment": comt})
            self.assertDictEqual(layman.absent(name), ret)

            with patch.dict(layman.__opts__, {"test": True}):
                comt = "Overlay {0} is set to be deleted".format(name)
                ret.update({"comment": comt, "result": None})
                self.assertDictEqual(layman.absent(name), ret)