Best Python code snippet using robotframework-appiumlibrary_python
remote_fs_tests.py
Source:remote_fs_tests.py
...16from io import BytesIO17from zipfile import ZipFile18from .helper.test_helper import BaseTestCase19class TestRemoteFs(BaseTestCase):20 def test_push_pull_file(self) -> None:21 dest_path = '/data/local/tmp/test_push_file.txt'22 data = bytes('This is the contents of the file to push to the device.', 'utf-8')23 self.driver.push_file(dest_path, base64.b64encode(data).decode('utf-8'))24 data_ret = base64.b64decode(self.driver.pull_file(dest_path))25 assert data == data_ret26 def test_pull_folder(self) -> None:27 data = bytes('random string data {}'.format(random.randint(0, 1000)), 'utf-8')28 dest_dir = '/data/local/tmp/'29 for filename in ['1.txt', '2.txt']:30 self.driver.push_file(os.path.join(dest_dir, filename), base64.b64encode(data).decode('utf-8'))31 folder = self.driver.pull_folder(dest_dir)32 with ZipFile(BytesIO(base64.b64decode(folder))) as fzip:33 for filename in ['1.txt', '2.txt']:34 assert filename in fzip.namelist()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!