michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: import os michael@0: import posixpath michael@0: michael@0: from dmunit import DeviceManagerTestCase michael@0: michael@0: class Push1TestCase(DeviceManagerTestCase): michael@0: michael@0: def runTest(self): michael@0: """This tests copying a directory structure to the device. michael@0: """ michael@0: dvroot = self.dm.getDeviceRoot() michael@0: dvpath = posixpath.join(dvroot, 'infratest') michael@0: self.dm.removeDir(dvpath) michael@0: self.dm.mkDir(dvpath) michael@0: michael@0: p1 = os.path.join('test-files', 'push1') michael@0: # Set up local stuff michael@0: try: michael@0: os.rmdir(p1) michael@0: except: michael@0: pass michael@0: michael@0: if not os.path.exists(p1): michael@0: os.makedirs(os.path.join(p1, 'sub.1', 'sub.2')) michael@0: if not os.path.exists(os.path.join(p1, 'sub.1', 'sub.2', 'testfile')): michael@0: file(os.path.join(p1, 'sub.1', 'sub.2', 'testfile'), 'w').close() michael@0: michael@0: self.dm.pushDir(p1, posixpath.join(dvpath, 'push1')) michael@0: michael@0: self.assertTrue( michael@0: self.dm.dirExists(posixpath.join(dvpath, 'push1', 'sub.1'))) michael@0: self.assertTrue(self.dm.dirExists( michael@0: posixpath.join(dvpath, 'push1', 'sub.1', 'sub.2')))