testing/mozbase/mozdevice/tests/sut_fileExists.py

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 from sut import MockAgent
     2 import mozdevice
     3 import unittest
     5 class FileExistsTest(unittest.TestCase):
     7     commands = [('isdir /', 'TRUE'),
     8                 ('cd /', ''),
     9                 ('ls', 'init')]
    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('/'))
    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'))
    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'))
    27 if __name__ == '__main__':
    28     unittest.main()

mercurial