|
1 from sut import MockAgent |
|
2 import mozdevice |
|
3 import unittest |
|
4 |
|
5 class FileExistsTest(unittest.TestCase): |
|
6 |
|
7 commands = [('isdir /', 'TRUE'), |
|
8 ('cd /', ''), |
|
9 ('ls', 'init')] |
|
10 |
|
11 def test_onRoot(self): |
|
12 root_commands = [('isdir /', 'TRUE')] |
|
13 a = MockAgent(self, commands=root_commands) |
|
14 d = mozdevice.DroidSUT("127.0.0.1", port=a.port) |
|
15 self.assertTrue(d.fileExists('/')) |
|
16 |
|
17 def test_onNonexistent(self): |
|
18 a = MockAgent(self, commands=self.commands) |
|
19 d = mozdevice.DroidSUT("127.0.0.1", port=a.port) |
|
20 self.assertFalse(d.fileExists('/doesNotExist')) |
|
21 |
|
22 def test_onRegularFile(self): |
|
23 a = MockAgent(self, commands=self.commands) |
|
24 d = mozdevice.DroidSUT("127.0.0.1", port=a.port) |
|
25 self.assertTrue(d.fileExists('/init')) |
|
26 |
|
27 if __name__ == '__main__': |
|
28 unittest.main() |
|
29 |