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"])
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'])
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'])