Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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/.
5 import tempfile
6 import posixpath
8 from dmunit import DeviceManagerTestCase
10 class FileExistsTestCase(DeviceManagerTestCase):
11 """This tests the "fileExists" command.
12 """
14 def testOnRoot(self):
15 self.assertTrue(self.dm.fileExists('/'))
17 def testOnNonexistent(self):
18 self.assertFalse(self.dm.fileExists('/doesNotExist'))
20 def testOnRegularFile(self):
21 remote_path = posixpath.join(self.dm.getDeviceRoot(), 'testFile')
22 self.assertFalse(self.dm.fileExists(remote_path))
23 with tempfile.NamedTemporaryFile() as f:
24 self.dm.pushFile(f.name, remote_path)
25 self.assertTrue(self.dm.fileExists(remote_path))
26 self.dm.removeFile(remote_path)
28 def testOnDirectory(self):
29 remote_path = posixpath.join(self.dm.getDeviceRoot(), 'testDir')
30 remote_path_file = posixpath.join(remote_path, 'testFile')
31 self.assertFalse(self.dm.fileExists(remote_path))
32 with tempfile.NamedTemporaryFile() as f:
33 self.dm.pushFile(f.name, remote_path_file)
34 self.assertTrue(self.dm.fileExists(remote_path))
35 self.dm.removeFile(remote_path_file)
36 self.dm.removeDir(remote_path)