michael@0: from sut import MockAgent michael@0: import mozdevice michael@0: import unittest michael@0: michael@0: class FileExistsTest(unittest.TestCase): michael@0: michael@0: commands = [('isdir /', 'TRUE'), michael@0: ('cd /', ''), michael@0: ('ls', 'init')] michael@0: michael@0: def test_onRoot(self): michael@0: root_commands = [('isdir /', 'TRUE')] michael@0: a = MockAgent(self, commands=root_commands) michael@0: d = mozdevice.DroidSUT("127.0.0.1", port=a.port) michael@0: self.assertTrue(d.fileExists('/')) michael@0: michael@0: def test_onNonexistent(self): michael@0: a = MockAgent(self, commands=self.commands) michael@0: d = mozdevice.DroidSUT("127.0.0.1", port=a.port) michael@0: self.assertFalse(d.fileExists('/doesNotExist')) michael@0: michael@0: def test_onRegularFile(self): michael@0: a = MockAgent(self, commands=self.commands) michael@0: d = mozdevice.DroidSUT("127.0.0.1", port=a.port) michael@0: self.assertTrue(d.fileExists('/init')) michael@0: michael@0: if __name__ == '__main__': michael@0: unittest.main() michael@0: