Example #1
0
    def test_logcat_no_regex(self):
        mock_adb = Mock()
        mock_adb.get_logcat.return_value = 'get_logcat output'
        Adb.adb = mock_adb

        device_id = 123

        result = Adb.logcat(device_id)

        assert result == 'get_logcat output'
        expected_calls = [
            call.set_target_by_name(device_id),
            call.get_logcat(lcfilter='-d')
        ]
        assert mock_adb.mock_calls == expected_calls
Example #2
0
    def test_logcat_with_regex(self):
        mock_adb = Mock()
        mock_adb.get_logcat.return_value = 'get_logcat output'
        Adb.adb = mock_adb

        test_regex = '[a-zA-Z]+'
        device_id = 123

        result = Adb.logcat(device_id, test_regex)

        assert result == 'get_logcat output'
        expected_calls = [
            call.set_target_by_name(device_id),
            call.get_logcat(lcfilter='-d -e {}'.format(test_regex))
        ]
        assert mock_adb.mock_calls == expected_calls