testing/mozbase/mozdevice/sut_tests/test_push1.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/mozbase/mozdevice/sut_tests/test_push1.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     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 Push1TestCase(DeviceManagerTestCase):
    1.14 +
    1.15 +    def runTest(self):
    1.16 +        """This tests copying a directory structure to the device.
    1.17 +        """
    1.18 +        dvroot = self.dm.getDeviceRoot()
    1.19 +        dvpath = posixpath.join(dvroot, 'infratest')
    1.20 +        self.dm.removeDir(dvpath)
    1.21 +        self.dm.mkDir(dvpath)
    1.22 +
    1.23 +        p1 = os.path.join('test-files', 'push1')
    1.24 +        # Set up local stuff
    1.25 +        try:
    1.26 +            os.rmdir(p1)
    1.27 +        except:
    1.28 +            pass
    1.29 +
    1.30 +        if not os.path.exists(p1):
    1.31 +            os.makedirs(os.path.join(p1, 'sub.1', 'sub.2'))
    1.32 +        if not os.path.exists(os.path.join(p1, 'sub.1', 'sub.2', 'testfile')):
    1.33 +            file(os.path.join(p1, 'sub.1', 'sub.2', 'testfile'), 'w').close()
    1.34 +
    1.35 +        self.dm.pushDir(p1, posixpath.join(dvpath, 'push1'))
    1.36 +
    1.37 +        self.assertTrue(
    1.38 +            self.dm.dirExists(posixpath.join(dvpath, 'push1', 'sub.1')))
    1.39 +        self.assertTrue(self.dm.dirExists(
    1.40 +            posixpath.join(dvpath, 'push1', 'sub.1', 'sub.2')))

mercurial