summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozdevice/tests/sut_ip.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/mozbase/mozdevice/tests/sut_ip.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/mozbase/mozdevice/tests/sut_ip.py')
-rw-r--r--testing/mozbase/mozdevice/tests/sut_ip.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/mozbase/mozdevice/tests/sut_ip.py b/testing/mozbase/mozdevice/tests/sut_ip.py
new file mode 100644
index 000000000..31428a624
--- /dev/null
+++ b/testing/mozbase/mozdevice/tests/sut_ip.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+import mozdevice
+import logging
+import unittest
+from sut import MockAgent
+
+
+class TestGetIP(unittest.TestCase):
+ """ class to test IP methods """
+
+ commands = [('exec ifconfig eth0', 'eth0: ip 192.168.0.1 '
+ 'mask 255.255.255.0 flags [up broadcast running multicast]\n'
+ 'return code [0]'),
+ ('exec ifconfig wlan0', 'wlan0: ip 10.1.39.126\n'
+ 'mask 255.255.0.0 flags [up broadcast running multicast]\n'
+ 'return code [0]'),
+ ('exec ifconfig fake0', '##AGENT-WARNING## [ifconfig] '
+ 'command with arg(s) = [fake0] is currently not implemented.')
+ ]
+
+ def test_getIP_eth0(self):
+ m = MockAgent(self, commands=[self.commands[0]])
+ d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
+ self.assertEqual('192.168.0.1', d.getIP(interfaces=['eth0']))
+
+ def test_getIP_wlan0(self):
+ m = MockAgent(self, commands=[self.commands[1]])
+ d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
+ self.assertEqual('10.1.39.126', d.getIP(interfaces=['wlan0']))
+
+ def test_getIP_error(self):
+ m = MockAgent(self, commands=[self.commands[2]])
+ d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=logging.DEBUG)
+ self.assertRaises(mozdevice.DMError, d.getIP, interfaces=['fake0'])
+
+if __name__ == '__main__':
+ unittest.main()