testing/mozbase/mozdevice/sut_tests/test_push2.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 import os
michael@0 6 import posixpath
michael@0 7
michael@0 8 from dmunit import DeviceManagerTestCase
michael@0 9
michael@0 10 class Push2TestCase(DeviceManagerTestCase):
michael@0 11
michael@0 12 def runTest(self):
michael@0 13 """This tests copying a directory structure with files to the device.
michael@0 14 """
michael@0 15 testroot = posixpath.join(self.dm.getDeviceRoot(), 'infratest')
michael@0 16 self.dm.removeDir(testroot)
michael@0 17 self.dm.mkDir(testroot)
michael@0 18 path = posixpath.join(testroot, 'push2')
michael@0 19 self.dm.pushDir(os.path.join('test-files', 'push2'), path)
michael@0 20
michael@0 21 # Let's walk the tree and make sure everything is there
michael@0 22 # though it's kind of cheesy, we'll use the validate file to compare
michael@0 23 # hashes - we use the client side hashing when testing the cat command
michael@0 24 # specifically, so that makes this a little less cheesy, I guess.
michael@0 25 self.assertTrue(
michael@0 26 self.dm.dirExists(posixpath.join(testroot, 'push2', 'sub1')))
michael@0 27 self.assertTrue(self.dm.validateFile(
michael@0 28 posixpath.join(testroot, 'push2', 'sub1', 'file1.txt'),
michael@0 29 os.path.join('test-files', 'push2', 'sub1', 'file1.txt')))
michael@0 30 self.assertTrue(self.dm.validateFile(
michael@0 31 posixpath.join(testroot, 'push2', 'sub1', 'sub1.1', 'file2.txt'),
michael@0 32 os.path.join('test-files', 'push2', 'sub1', 'sub1.1', 'file2.txt')))
michael@0 33 self.assertTrue(self.dm.validateFile(
michael@0 34 posixpath.join(testroot, 'push2', 'sub2', 'file3.txt'),
michael@0 35 os.path.join('test-files', 'push2', 'sub2', 'file3.txt')))
michael@0 36 self.assertTrue(self.dm.validateFile(
michael@0 37 posixpath.join(testroot, 'push2', 'file4.bin'),
michael@0 38 os.path.join('test-files', 'push2', 'file4.bin')))

mercurial