testing/mozbase/mozdevice/sut_tests/test_push1.py

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:3213ec1a9f50
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 import os
6 import posixpath
7
8 from dmunit import DeviceManagerTestCase
9
10 class Push1TestCase(DeviceManagerTestCase):
11
12 def runTest(self):
13 """This tests copying a directory structure to the device.
14 """
15 dvroot = self.dm.getDeviceRoot()
16 dvpath = posixpath.join(dvroot, 'infratest')
17 self.dm.removeDir(dvpath)
18 self.dm.mkDir(dvpath)
19
20 p1 = os.path.join('test-files', 'push1')
21 # Set up local stuff
22 try:
23 os.rmdir(p1)
24 except:
25 pass
26
27 if not os.path.exists(p1):
28 os.makedirs(os.path.join(p1, 'sub.1', 'sub.2'))
29 if not os.path.exists(os.path.join(p1, 'sub.1', 'sub.2', 'testfile')):
30 file(os.path.join(p1, 'sub.1', 'sub.2', 'testfile'), 'w').close()
31
32 self.dm.pushDir(p1, posixpath.join(dvpath, 'push1'))
33
34 self.assertTrue(
35 self.dm.dirExists(posixpath.join(dvpath, 'push1', 'sub.1')))
36 self.assertTrue(self.dm.dirExists(
37 posixpath.join(dvpath, 'push1', 'sub.1', 'sub.2')))

mercurial