Message ID | VI1P190MB0493802F19F29DD225F55FDF9F439@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM |
---|---|
State | Superseded |
Headers | show |
Series | [1/4] package/polkit: fix typo in POLKIT_IGNORE_CVES | expand |
>>>>> "Lang" == Lang Daniel via buildroot <buildroot@buildroot.org> writes: > Polkit has two directories that are used to store rules. > Add the second directory to the existing tests, to ensure > that both work in the future. > Signed-off-by: Daniel Lang <d.lang@abatec.at> > --- > support/testing/tests/package/test_polkit.py | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > diff --git a/support/testing/tests/package/test_polkit.py b/support/testing/tests/package/test_polkit.py > index 502d38d13e..dbba42042b 100644 > --- a/support/testing/tests/package/test_polkit.py > +++ b/support/testing/tests/package/test_polkit.py > @@ -48,6 +48,14 @@ class TestPolkitSystemd(TestPolkitInfra): > _, exit_code = self.emulator.run(cmd, 10) > self.assertEqual(exit_code, 0) > + cmd = "mv /etc/polkit-1/rules.d/systemd-timesyncd-restart.rules /usr/share/polkit-1/rules.d" > + _, exit_code = self.emulator.run(cmd, 10) > + self.assertEqual(exit_code, 0) > + > + cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'" > + _, exit_code = self.emulator.run(cmd, 10) > + self.assertEqual(exit_code, 0) How about rewriting this as a loop over the two directories instead of repeating the code?
diff --git a/support/testing/tests/package/test_polkit.py b/support/testing/tests/package/test_polkit.py index 502d38d13e..dbba42042b 100644 --- a/support/testing/tests/package/test_polkit.py +++ b/support/testing/tests/package/test_polkit.py @@ -48,6 +48,14 @@ class TestPolkitSystemd(TestPolkitInfra): _, exit_code = self.emulator.run(cmd, 10) self.assertEqual(exit_code, 0) + cmd = "mv /etc/polkit-1/rules.d/systemd-timesyncd-restart.rules /usr/share/polkit-1/rules.d" + _, exit_code = self.emulator.run(cmd, 10) + self.assertEqual(exit_code, 0) + + cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'" + _, exit_code = self.emulator.run(cmd, 10) + self.assertEqual(exit_code, 0) + class TestPolkitInitd(TestPolkitInfra): config = TestPolkitInfra.config @@ -68,3 +76,12 @@ class TestPolkitInitd(TestPolkitInfra): output, exit_code = self.emulator.run(cmd, 10) self.assertEqual(exit_code, 0) self.assertEqual(output[0], "Hello polkit!") + + cmd = "mv /etc/polkit-1/rules.d/hello-polkit.rules /usr/share/polkit-1/rules.d/hello-polkit.rules" + _, exit_code = self.emulator.run(cmd, 10) + self.assertEqual(exit_code, 0) + + cmd = "su brtest -c 'pkexec hello-polkit'" + output, exit_code = self.emulator.run(cmd, 10) + self.assertEqual(exit_code, 0) + self.assertEqual(output[0], "Hello polkit!")
Polkit has two directories that are used to store rules. Add the second directory to the existing tests, to ensure that both work in the future. Signed-off-by: Daniel Lang <d.lang@abatec.at> --- support/testing/tests/package/test_polkit.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)