示例#1
0
 def test_get_enabled(self):
     """
         Test to return the enabled services
     """
     mock = MagicMock(return_value=[
         {
             "ServiceName": "spongebob"
         },
         {
             "ServiceName": "squarepants"
         },
         {
             "ServiceName": "patrick"
         },
     ])
     with patch.object(win_service, "_get_services", mock):
         mock_info = MagicMock(side_effect=[
             {
                 "StartType": "Auto"
             },
             {
                 "StartType": "Manual"
             },
             {
                 "StartType": "Disabled"
             },
         ])
         with patch.object(win_service, "info", mock_info):
             self.assertListEqual(win_service.get_enabled(), ["spongebob"])
示例#2
0
 def test_get_enabled(self):
     '''
         Test to return the enabled services
     '''
     mock = MagicMock(return_value=['c', 'a', 'b'])
     with patch.object(win_service, 'get_all', mock):
         mock = MagicMock(side_effect=[True, False, True])
         with patch.object(win_service, 'enabled', mock):
             self.assertListEqual(win_service.get_enabled(), ['b', 'c'])
示例#3
0
 def test_get_enabled(self):
     '''
         Test to return the enabled services
     '''
     mock = MagicMock(return_value=['c', 'a', 'b'])
     with patch.object(win_service, 'get_all', mock):
         mock = MagicMock(side_effect=[True, False, True])
         with patch.object(win_service, 'enabled', mock):
             self.assertListEqual(win_service.get_enabled(), ['b', 'c'])
示例#4
0
 def test_get_enabled(self):
     '''
         Test to return the enabled services
     '''
     mock = MagicMock(return_value=[{'ServiceName': 'spongebob'},
                                    {'ServiceName': 'squarepants'},
                                    {'ServiceName': 'patrick'}])
     with patch.object(win_service, '_get_services', mock):
         mock_info = MagicMock(side_effect=[{'StartType': 'Auto'},
                                            {'StartType': 'Manual'},
                                            {'StartType': 'Disabled'}])
         with patch.object(win_service, 'info', mock_info):
             self.assertListEqual(win_service.get_enabled(),
                                  ['spongebob'])
示例#5
0
 def test_get_enabled(self):
     '''
         Test to return the enabled services
     '''
     mock = MagicMock(return_value=[{'ServiceName': 'spongebob'},
                                    {'ServiceName': 'squarepants'},
                                    {'ServiceName': 'patrick'}])
     with patch.object(win_service, '_get_services', mock):
         mock_info = MagicMock(side_effect=[{'StartType': 'Auto'},
                                            {'StartType': 'Manual'},
                                            {'StartType': 'Disabled'}])
         with patch.object(win_service, 'info', mock_info):
             self.assertListEqual(win_service.get_enabled(),
                                  ['spongebob'])