1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mozbase/mozdevice/tests/sut_fileExists.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +from sut import MockAgent 1.5 +import mozdevice 1.6 +import unittest 1.7 + 1.8 +class FileExistsTest(unittest.TestCase): 1.9 + 1.10 + commands = [('isdir /', 'TRUE'), 1.11 + ('cd /', ''), 1.12 + ('ls', 'init')] 1.13 + 1.14 + def test_onRoot(self): 1.15 + root_commands = [('isdir /', 'TRUE')] 1.16 + a = MockAgent(self, commands=root_commands) 1.17 + d = mozdevice.DroidSUT("127.0.0.1", port=a.port) 1.18 + self.assertTrue(d.fileExists('/')) 1.19 + 1.20 + def test_onNonexistent(self): 1.21 + a = MockAgent(self, commands=self.commands) 1.22 + d = mozdevice.DroidSUT("127.0.0.1", port=a.port) 1.23 + self.assertFalse(d.fileExists('/doesNotExist')) 1.24 + 1.25 + def test_onRegularFile(self): 1.26 + a = MockAgent(self, commands=self.commands) 1.27 + d = mozdevice.DroidSUT("127.0.0.1", port=a.port) 1.28 + self.assertTrue(d.fileExists('/init')) 1.29 + 1.30 +if __name__ == '__main__': 1.31 + unittest.main() 1.32 +