def test_gets_device_info_for_android_devices(self, mock_android_device_information, mock_runner): mock_response = mock.Mock() mock_response.is_successful.return_value = True type(mock_response).frida_version = mock.PropertyMock(return_value='10.0.1') type(mock_response).device_type = mock.PropertyMock(return_value='android') mock_runner.return_value.get_last_message.return_value = mock_response mock_android_device_information.return_value = ('a', 'b', 'c', 'd') self.assertEqual(get_device_info(), ('a', 'b', 'c', 'd'))
def test_gets_ios_device_info(self, mock_api): mock_api.return_value.env_runtime.return_value = 'ios' mock_api.return_value.env_ios.return_value = { 'applicationName': 'za.sensepost.ipewpew', 'deviceName': 'skdw', 'identifierForVendor': 'A549BC3C-ADA7-49D4-8B3C-A22187F461F5', 'model': 'iPhone', 'systemName': 'iOS', 'systemVersion': '11.4' } self.assertEqual(get_device_info(), ('za.sensepost.ipewpew', 'iOS', 'iPhone', '11.4'))
def test_gets_android_device_info(self, mock_api): mock_api.return_value.env_runtime.return_value = 'android' mock_api.return_value.env_android.return_value = { 'application_name': 'com.sensepost.apewpew', 'board': 'universal5422', 'brand': 'samsung', 'device': 'foobaz', 'host': 'foo.local', 'id': 'foobar', 'model': 'SM-G900H', 'product': 'k3gxx', 'user': '******', 'version': '7.1.2' } self.assertEqual( get_device_info(), ('com.sensepost.apewpew', 'foobaz', 'samsung', '7.1.2'))