1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mozbase/mozdevice/sut_tests/test_push2.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +import os 1.9 +import posixpath 1.10 + 1.11 +from dmunit import DeviceManagerTestCase 1.12 + 1.13 +class Push2TestCase(DeviceManagerTestCase): 1.14 + 1.15 + def runTest(self): 1.16 + """This tests copying a directory structure with files to the device. 1.17 + """ 1.18 + testroot = posixpath.join(self.dm.getDeviceRoot(), 'infratest') 1.19 + self.dm.removeDir(testroot) 1.20 + self.dm.mkDir(testroot) 1.21 + path = posixpath.join(testroot, 'push2') 1.22 + self.dm.pushDir(os.path.join('test-files', 'push2'), path) 1.23 + 1.24 + # Let's walk the tree and make sure everything is there 1.25 + # though it's kind of cheesy, we'll use the validate file to compare 1.26 + # hashes - we use the client side hashing when testing the cat command 1.27 + # specifically, so that makes this a little less cheesy, I guess. 1.28 + self.assertTrue( 1.29 + self.dm.dirExists(posixpath.join(testroot, 'push2', 'sub1'))) 1.30 + self.assertTrue(self.dm.validateFile( 1.31 + posixpath.join(testroot, 'push2', 'sub1', 'file1.txt'), 1.32 + os.path.join('test-files', 'push2', 'sub1', 'file1.txt'))) 1.33 + self.assertTrue(self.dm.validateFile( 1.34 + posixpath.join(testroot, 'push2', 'sub1', 'sub1.1', 'file2.txt'), 1.35 + os.path.join('test-files', 'push2', 'sub1', 'sub1.1', 'file2.txt'))) 1.36 + self.assertTrue(self.dm.validateFile( 1.37 + posixpath.join(testroot, 'push2', 'sub2', 'file3.txt'), 1.38 + os.path.join('test-files', 'push2', 'sub2', 'file3.txt'))) 1.39 + self.assertTrue(self.dm.validateFile( 1.40 + posixpath.join(testroot, 'push2', 'file4.bin'), 1.41 + os.path.join('test-files', 'push2', 'file4.bin')))