def test_root_faile(self): ''' Test root fail. ''' str_ret = 'adbd cannot run as root in production builds' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertFalse(ret, 'The result should be False.')
def test_root_faile(self): """ Test root fail. """ str_ret = 'adbd cannot run as root in production builds' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertFalse(ret, 'The result should be False.')
def test_root(self): ''' Test root. ''' # test adb already running as root str_ret = 'adbd is already running as root' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertTrue(ret, 'The result should be True') # test adb not running, then running as root str_ret = textwrap.dedent('''\ * daemon not running. starting it now on port 5037 * * daemon started successfully * adbd is already running as root''') self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertTrue(ret, 'The result should be True.')
def test_root(self): """ Test root. """ # test adb already running as root str_ret = 'adbd is already running as root' self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertTrue(ret, 'The result should be True') # test adb not running, then running as root str_ret = textwrap.dedent("""\ * daemon not running. starting it now on port 5037 * * daemon started successfully * adbd is already running as root""") self.mock_obj.communicate.return_value = [str_ret, None] self.mock_popen.return_value = self.mock_obj ret = AdbWrapper.adb_root() self.assertTrue(ret, 'The result should be True.')