summaryrefslogtreecommitdiffstats
path: root/adb/tests/test_adb.py
diff options
context:
space:
mode:
Diffstat (limited to 'adb/tests/test_adb.py')
-rwxr-xr-x[-rw-r--r--]adb/tests/test_adb.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/adb/tests/test_adb.py b/adb/tests/test_adb.py
index b0ae07f..4b3baf3 100644..100755
--- a/adb/tests/test_adb.py
+++ b/adb/tests/test_adb.py
@@ -8,11 +8,11 @@ import hashlib
import os
import random
import re
+import shlex
import subprocess
+import sys
import tempfile
import unittest
-import sys
-import shlex
def trace(cmd):
@@ -181,6 +181,12 @@ class AdbWrapper(object):
def usb(self):
return call_checked(self.adb_cmd + "usb")
+ def root(self):
+ return call_checked(self.adb_cmd + "root")
+
+ def unroot(self):
+ return call_checked(self.adb_cmd + "unroot")
+
def forward_remove(self, local):
return call_checked(self.adb_cmd + "forward --remove {}".format(local))
@@ -233,6 +239,17 @@ class AdbBasic(unittest.TestCase):
version_num = True
self.assertTrue(version_num)
+ def test_root_unroot(self):
+ """Make sure that adb root and adb unroot work, using id(1)."""
+ for device in get_device_list():
+ adb = AdbWrapper(device)
+ adb.root()
+ adb.wait()
+ self.assertEqual("root", adb.shell("id -un").strip())
+ adb.unroot()
+ adb.wait()
+ self.assertEqual("shell", adb.shell("id -un").strip())
+
class AdbFile(unittest.TestCase):
SCRATCH_DIR = "/data/local/tmp"