summaryrefslogtreecommitdiff
path: root/morphlib/execute_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-10-03 09:51:52 +0100
committerLars Wirzenius <liw@liw.fi>2011-10-03 09:51:52 +0100
commit60768275cc746890b826b240eb0d6d04a6b9d046 (patch)
treef255b40a1f5f936624e7fea8d4d67e67ef9ac749 /morphlib/execute_tests.py
parentae0c04d3c10fa3e5ff91f387a25d1903a1b2c5a8 (diff)
downloadmorph-60768275cc746890b826b240eb0d6d04a6b9d046.tar.gz
Make Execute.run and .runv be able to easily run commands as root.
Diffstat (limited to 'morphlib/execute_tests.py')
-rw-r--r--morphlib/execute_tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/morphlib/execute_tests.py b/morphlib/execute_tests.py
index dffc5a7f..2aedcd7a 100644
--- a/morphlib/execute_tests.py
+++ b/morphlib/execute_tests.py
@@ -52,3 +52,9 @@ class ExecuteTests(unittest.TestCase):
def test_runv_sets_working_directory(self):
self.assertEqual(self.e.runv(['pwd']), '/\n')
+ def test_runs_as_root_when_requested(self):
+ self.assertEqual(self.e.run(['id -u'], as_root=True), ['0\n'])
+
+ def test_runvs_as_root_when_requested(self):
+ self.assertEqual(self.e.runv(['id', '-u'], as_root=True), '0\n')
+