On 8 September 2016 at 02:26, Edwin Plauchu <
[email protected]> wrote:
> def test_rpm_query_nonroot(self):
> - (status, output) = self.target.run('useradd test1')
> + test_user = 'test1'
> + (status, output) = self.target.run("useradd %s" % test_user)
> self.assertTrue(status == 0, msg="Failed to create new user: " +
> output)
> - (status, output) = self.target.run('su -c id test1')
> + (status, output) = self.target.run("su -c id %s" % test_user)
> self.assertTrue('(test1)' in output, msg="Failed to execute as
> new user")
> - (status, output) = self.target.run('su -c "rpm -qa" test1 ')
> + (status, output) = self.target.run("su -c \"rpm -qa\" %s " %
> test_user)
> self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa:
> %s" % (status, output))
> + (status, output) = self.target.run("userdel -r %s" % test_user)
> + self.assertTrue(status == 0, msg="Failed to erase user: %s" %
> output)
>
The user removal should be in a try/finally block around the test so that
it always executes even if the test fails.
Ross
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core