summaryrefslogtreecommitdiff
path: root/lib/remote_access_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/remote_access_unittest.py')
-rw-r--r--lib/remote_access_unittest.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/remote_access_unittest.py b/lib/remote_access_unittest.py
index 7f575ce2c..d02a52174 100644
--- a/lib/remote_access_unittest.py
+++ b/lib/remote_access_unittest.py
@@ -21,7 +21,7 @@ from chromite.lib import partial_mock
from chromite.lib import remote_access
-# pylint: disable=W0212
+# pylint: disable=protected-access
class TestNormalizePort(cros_test_lib.TestCase):
@@ -270,6 +270,21 @@ class RemoteDeviceTest(cros_test_lib.MockTestCase):
self.assertEqual(expected_output,
device.BaseRunCommand(['echo', 'foo']).output)
+ def testDelayedRemoteDirs(self):
+ """Tests the delayed creation of base_dir/work_dir."""
+ with remote_access.RemoteDeviceHandler('1.1.1.1', base_dir='/f') as device:
+ # Make sure we didn't talk to the remote yet.
+ self.assertEqual(self.rsh_mock.call_count, 0)
+
+ # The work dir will get automatically created when we use it.
+ self.rsh_mock.AddCmdResult(partial_mock.In('mkdir'))
+ self.rsh_mock.AddCmdResult(partial_mock.In('mktemp'))
+ _ = device.work_dir
+ self.assertEqual(self.rsh_mock.call_count, 2)
+
+ # Add a mock for the clean up logic.
+ self.rsh_mock.AddCmdResult(partial_mock.In('rm'))
+
class USBDeviceTestCase(mdns_unittest.mDnsTestCase):
"""Base class for USB device related tests."""