support/testing: use .assertRunOk() when possible

The BRTest() class implements an assertRunOk() method that does the
very common work of running a command inside the emulator, and
checking that it is successful.

This commit changes all locations where this .assertRunOk() method can
be used, instead of open-coding the same logic.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Thomas Petazzoni
2021-06-26 15:32:38 +02:00
committed by Yann E. MORIN
parent f579afc393
commit afc1ed4d51
24 changed files with 51 additions and 91 deletions

View File

@@ -33,9 +33,7 @@ class TestAtop(infra.basetest.BRTest):
self.emulator.login()
cmd = "atop -V | grep '^Version'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
self.assertRunOk(cmd)
cmd = "atop -a 1 2 | grep '% *atop *$'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
self.assertRunOk(cmd)