on xenial help sign in
Use subprocess
commitcdc537da3aaab7de16ae1a411bb741f4cdc34aa9 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateMon 27 Jan 2014, 10:33 (13 years ago) parent1526af5
1 file changed+6−2
tests/autopilot/unity8/shell/tests/test_system_integration.py+6−2
tests/autopilot/unity8/shell/tests/test_system_integration.py+6−2
@@ -19,7 +19,7 @@
1919
2020"""Tests for system integration."""
2121
22−import os
22+import subprocess
2323
2424from unity8.shell.emulators import UnityEmulatorBase
2525from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
@@ -31,5 +31,9 @@ class SystemIntegrationTests(UnityTestCase):
3131 scenarios = _get_device_emulation_scenarios()
3232
3333 def test_networkmanager_integration(self):
34− retvalue = os.system("pkcheck --action-id org.freedesktop.NetworkManager.enable-disable-network --process `pidof -s unity8`")
34+ self.launch_unity()
35+
36+ # invoke policykit to check permissions
37+ pid = subprocess.check_output("pidof -s unity8", shell=True)
38+ retvalue = subprocess.check_call("pkcheck --action-id org.freedesktop.NetworkManager.enable-disable-network --process " + pid, shell=True)
3539 self.assertThat(retvalue, Equals(0))