diff --git a/support/testing/tests/package/test_polkit.py b/support/testing/tests/package/test_polkit.py index 3414fd5159..8ff02d91df 100644 --- a/support/testing/tests/package/test_polkit.py +++ b/support/testing/tests/package/test_polkit.py @@ -43,20 +43,16 @@ class TestPolkitSystemd(TestPolkitInfra): rule_file = "systemd-timesyncd-restart.rules" for rule_path in TestPolkitInfra.rule_paths: cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'" - _, exit_code = self.emulator.run(cmd, 10) - self.assertNotEqual(exit_code, 0) + self.assertRunNotOk(cmd, 10) cmd = "cp /root/{file} {path}".format(file=rule_file, path=rule_path) - _, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) + self.assertRunOk(cmd, 10) cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'" - _, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) + self.assertRunOk(cmd, 10) cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path) - _, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) + self.assertRunOk(cmd, 10) class TestPolkitInitd(TestPolkitInfra): @@ -73,8 +69,7 @@ class TestPolkitInitd(TestPolkitInfra): self.assertEqual(output[0], "Error executing command as another user: Not authorized") cmd = "cp /root/{file} {path}/{file}".format(file=rule_file, path=rule_path) - _, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) + self.assertRunOk(cmd, 10) cmd = "su brtest -c 'pkexec hello-polkit'" output, exit_code = self.emulator.run(cmd, 10) @@ -82,5 +77,4 @@ class TestPolkitInitd(TestPolkitInfra): self.assertEqual(output[0], "Hello polkit!") cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path) - _, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) + self.assertRunOk(cmd, 10)