-
Notifications
You must be signed in to change notification settings - Fork 57
/
test_adb_manager_async_temp.py
37 lines (24 loc) · 1.2 KB
/
test_adb_manager_async_temp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import unittest
from unittest.mock import patch
sys.path.insert(0, '..')
from androidtv.adb_manager.adb_manager_async import ClientAsync
from .async_wrapper import awaiter
from . import patchers
class TestAsyncClientDevice(unittest.TestCase):
"""Test the ``ClientAsync`` and ``DeviceAsync`` classes defined in ``adb_manager_async.py``.
This file can be removed once true async support for using an ADB server is available.
"""
@awaiter
async def test_async_client_device(self):
with patch("androidtv.adb_manager.adb_manager_async.Client", patchers.ClientFakeSuccess):
client = ClientAsync("host", "port")
device = await client.device("serial")
with patch("{}.DeviceFake.shell".format(patchers.__name__)):
await device.shell("test")
with patch("{}.DeviceFake.push".format(patchers.__name__)):
await device.push("local_path", "device_path")
with patch("{}.DeviceFake.pull".format(patchers.__name__)):
await device.pull("device_path", "local_path")
with patch("{}.DeviceFake.screencap".format(patchers.__name__)):
await device.screencap()