Esempio n. 1
0
    def test_status(self):
        '''
            Test to return the status for a service
        '''
        mock = MagicMock(side_effect=["RUNNING", "STOP_PENDING", ""])
        with patch.dict(win_service.__salt__, {'cmd.run': mock}):
            self.assertTrue(win_service.status("salt"))

            self.assertTrue(win_service.status("salt"))

            self.assertFalse(win_service.status("salt"))
Esempio n. 2
0
    def test_status(self):
        '''
            Test to return the status for a service
        '''
        mock = MagicMock(side_effect=["RUNNING", "STOP_PENDING", ""])
        with patch.dict(win_service.__salt__, {'cmd.run': mock}):
            self.assertTrue(win_service.status("salt"))

            self.assertTrue(win_service.status("salt"))

            self.assertFalse(win_service.status("salt"))
Esempio n. 3
0
    def test_status(self):
        '''
            Test to return the status for a service
        '''
        mock_info = MagicMock(side_effect=[{'Status': 'Running'},
                                           {'Status': 'Stop Pending'},
                                           {'Status': 'Stopped'}])

        with patch.object(win_service, 'info', mock_info):
            self.assertTrue(win_service.status('spongebob'))
            self.assertTrue(win_service.status('patrick'))
            self.assertFalse(win_service.status('squidward'))
Esempio n. 4
0
    def test_status(self):
        '''
            Test to return the status for a service
        '''
        mock_info = MagicMock(side_effect=[{'Status': 'Running'},
                                           {'Status': 'Stop Pending'},
                                           {'Status': 'Stopped'}])

        with patch.object(win_service, 'info', mock_info):
            self.assertTrue(win_service.status('spongebob'))
            self.assertTrue(win_service.status('patrick'))
            self.assertFalse(win_service.status('squidward'))
Esempio n. 5
0
    def test_status(self):
        """
            Test to return the status for a service
        """
        mock_info = MagicMock(side_effect=[
            {
                "Status": "Running"
            },
            {
                "Status": "Stop Pending"
            },
            {
                "Status": "Stopped"
            },
        ])

        with patch.object(win_service, "info", mock_info):
            self.assertTrue(win_service.status("spongebob"))
            self.assertTrue(win_service.status("patrick"))
            self.assertFalse(win_service.status("squidward"))