Esempio n. 1
0
    def test_disabled(self):
        '''
        Test to disable the RDP service.
        '''
        name = 'my_service'

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

        mock = MagicMock(side_effect=[True, True, False])
        mock_t = MagicMock(return_value=True)
        with patch.dict(rdp.__salt__,
                        {'rdp.status': mock,
                         'rdp.disable': mock_t}):
            with patch.dict(rdp.__opts__, {'test': True}):
                comt = ('RDP will be disabled')
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(rdp.disabled(name), ret)

            with patch.dict(rdp.__opts__, {'test': False}):
                ret.update({'comment': '', 'result': True,
                            'changes': {'RDP was disabled': True}})
                self.assertDictEqual(rdp.disabled(name), ret)

                comt = ('RDP is disabled')
                ret.update({'comment': comt, 'result': True, 'changes': {}})
                self.assertDictEqual(rdp.disabled(name), ret)
Esempio n. 2
0
    def test_disabled(self):
        '''
        Test to disable the RDP service.
        '''
        name = 'my_service'

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

        mock = MagicMock(side_effect=[True, True, False])
        mock_t = MagicMock(return_value=True)
        with patch.dict(rdp.__salt__, {
                'rdp.status': mock,
                'rdp.disable': mock_t
        }):
            with patch.dict(rdp.__opts__, {'test': True}):
                comt = ('RDP will be disabled')
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(rdp.disabled(name), ret)

            with patch.dict(rdp.__opts__, {'test': False}):
                ret.update({
                    'comment': '',
                    'result': True,
                    'changes': {
                        'RDP was disabled': True
                    }
                })
                self.assertDictEqual(rdp.disabled(name), ret)

                comt = ('RDP is disabled')
                ret.update({'comment': comt, 'result': True, 'changes': {}})
                self.assertDictEqual(rdp.disabled(name), ret)
Esempio n. 3
0
def test_disabled():
    """
    Test to disable the RDP service.
    """
    name = "my_service"

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

    mock = MagicMock(side_effect=[True, True, False])
    mock_t = MagicMock(return_value=True)
    with patch.dict(rdp.__salt__, {"rdp.status": mock, "rdp.disable": mock_t}):
        with patch.dict(rdp.__opts__, {"test": True}):
            comt = "RDP will be disabled"
            ret.update({"comment": comt, "result": None})
            assert rdp.disabled(name) == ret

        with patch.dict(rdp.__opts__, {"test": False}):
            ret.update({
                "comment": "",
                "result": True,
                "changes": {
                    "RDP was disabled": True
                }
            })
            assert rdp.disabled(name) == ret

            comt = "RDP is disabled"
            ret.update({"comment": comt, "result": True, "changes": {}})
            assert rdp.disabled(name) == ret