Esempio n. 1
0
    def test_process(self):
        """
        Test to return whether the specified signature
        is found in the process tree.
        """
        name = "mymonitor"

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

        mock = MagicMock(side_effect=[{}, {name: 1}])
        with patch.dict(status.__salt__, {"status.pid": mock}):
            comt = 'Process signature "mymonitor" not found '
            ret.update({"comment": comt, "result": False})
            self.assertDictEqual(status.process(name), ret)

            comt = 'Process signature "mymonitor" was found '
            ret.update({"comment": comt, "result": True, "data": {name: 1}})
            self.assertDictEqual(status.process(name), ret)
Esempio n. 2
0
    def test_process(self):
        '''
        Test to return whether the specified signature
        is found in the process tree.
        '''
        name = 'mymonitor'

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

        mock = MagicMock(side_effect=[{}, {name: 1}])
        with patch.dict(status.__salt__, {'status.pid': mock}):
            comt = ('Process signature "mymonitor" not found ')
            ret.update({'comment': comt, 'result': False})
            self.assertDictEqual(status.process(name), ret)

            comt = ('Process signature "mymonitor" was found ')
            ret.update({'comment': comt, 'result': True,
                        'data': {name: 1}})
            self.assertDictEqual(status.process(name), ret)