def test_create_with_string_list(self): string_list = [u'1', '2'] actual_ads = android_device.create(string_list) for actual_ad, expected_serial in zip(actual_ads, ['1', '2']): self.assertEqual(actual_ad.serial, expected_serial)
def test_create_with_pickup_all(self): pick_all_token = android_device.ANDROID_DEVICE_PICK_ALL_TOKEN actual_ads = android_device.create(pick_all_token) for actual, expected in zip(actual_ads, mock_android_device.get_mock_ads(5)): self.assertEqual(actual.serial, expected.serial)
def test_create_with_no_valid_config(self): expected_msg = 'No valid config found in: .*' with self.assertRaisesRegex(android_device.Error, expected_msg): android_device.create([1])
def test_create_with_not_list_config(self): expected_msg = android_device.ANDROID_DEVICE_NOT_LIST_CONFIG_MSG with self.assertRaisesRegex(android_device.Error, expected_msg): android_device.create('HAHA')
def test_create_with_empty_config(self): expected_msg = android_device.ANDROID_DEVICE_EMPTY_CONFIG_MSG with self.assertRaisesRegex(android_device.Error, expected_msg): android_device.create([])
def test_create_with_usb_id(self, mock_list_adb_devices_by_usb_id): string_list = [{'serial': '1'}, {'serial': '2'}, {'serial': 'usb:1'}] actual_ads = android_device.create(string_list) for actual_ad, expected_serial in zip(actual_ads, ['1', '2', 'usb:1']): self.assertEqual(actual_ad.serial, expected_serial)