Ejemplo n.º 1
0
 def test_get_device_success_with_serial_and_extra_field(self):
     ads = mock_android_device.get_mock_ads(5)
     expected_serial = '1'
     expected_h_port = 5555
     ads[1].h_port = expected_h_port
     ad = android_device.get_device(
         ads, serial=expected_serial, h_port=expected_h_port)
     self.assertEqual(ad.serial, expected_serial)
     self.assertEqual(ad.h_port, expected_h_port)
Ejemplo n.º 2
0
 def test_get_device_too_many_matches(self):
     ads = mock_android_device.get_mock_ads(5)
     target_serial = ads[1].serial = ads[0].serial
     expected_msg = r"More than one device matched: \['0', '0'\]"
     with self.assertRaisesRegex(android_device.Error, expected_msg):
         android_device.get_device(ads, serial=target_serial)
Ejemplo n.º 3
0
 def test_get_device_no_match(self):
     ads = mock_android_device.get_mock_ads(5)
     expected_msg = ('Could not find a target device that matches condition'
                     ": {'serial': 5}.")
     with self.assertRaisesRegex(android_device.Error, expected_msg):
         ad = android_device.get_device(ads, serial=len(ads))
Ejemplo n.º 4
0
 def test_get_device_success_with_serial(self):
     ads = mock_android_device.get_mock_ads(5)
     expected_serial = '0'
     ad = android_device.get_device(ads, serial=expected_serial)
     self.assertEqual(ad.serial, expected_serial)