예제 #1
0
    def test_GetApplicationPaths_noPaths(self):
        """Nothing containing text of package name found in output."""
        # pylint: disable=protected-access
        mock_device = mock.Mock(spec=device_utils.DeviceUtils)
        mock_device.RunShellCommand.configure_mock(return_value=[])

        paths = system_app._GetApplicationPaths(mock_device, _PACKAGE_NAME)

        self.assertEquals([], paths)
        mock_device.RunShellCommand.assert_called_once_with(
            _PM_LIST_PACKAGES_COMMAND, check_return=True)
예제 #2
0
    def test_GetApplicationPaths_notFound(self):
        """Path not found in output, only another package with similar name."""
        # pylint: disable=protected-access
        mock_device = mock.Mock(spec=device_utils.DeviceUtils)
        mock_device.RunShellCommand.configure_mock(
            return_value=_PM_LIST_PACKAGES_OUTPUT_WITHOUT_PATH)

        paths = system_app._GetApplicationPaths(mock_device, _PACKAGE_NAME)

        self.assertEquals([], paths)
        mock_device.RunShellCommand.assert_called_once_with(
            _PM_LIST_PACKAGES_COMMAND, check_return=True)
예제 #3
0
    def test_GetApplicationPaths_emptyName(self):
        """Called with empty name, should not return any packages."""
        # pylint: disable=protected-access
        mock_device = mock.Mock(spec=device_utils.DeviceUtils)
        mock_device.RunShellCommand.configure_mock(
            return_value=_PM_LIST_PACKAGES_OUTPUT_WITH_PATH)

        paths = system_app._GetApplicationPaths(mock_device, '')

        self.assertEquals([], paths)
        mock_device.RunShellCommand.assert_called_once_with(
            _PM_LIST_PACKAGES_COMMAND[:-1] + [''], check_return=True)
예제 #4
0
  def test_GetApplicationPaths_notFound(self):
    """Path not found in output, only another package with similar name."""
    # pylint: disable=protected-access
    mock_device = mock.Mock(spec=device_utils.DeviceUtils)
    mock_device.RunShellCommand.configure_mock(
        return_value=_PM_LIST_PACKAGES_OUTPUT_WITHOUT_PATH
    )

    paths = system_app._GetApplicationPaths(mock_device, _PACKAGE_NAME)

    self.assertEquals([], paths)
    mock_device.RunShellCommand.assert_called_once_with(
        _PM_LIST_PACKAGES_COMMAND, check_return=True)
예제 #5
0
  def test_GetApplicationPaths_emptyName(self):
    """Called with empty name, should not return any packages."""
    # pylint: disable=protected-access
    mock_device = mock.Mock(spec=device_utils.DeviceUtils)
    mock_device.RunShellCommand.configure_mock(
        return_value=_PM_LIST_PACKAGES_OUTPUT_WITH_PATH
    )

    paths = system_app._GetApplicationPaths(mock_device, '')

    self.assertEquals([], paths)
    mock_device.RunShellCommand.assert_called_once_with(
        _PM_LIST_PACKAGES_COMMAND[:-1] + [''], check_return=True)
예제 #6
0
  def test_GetApplicationPaths_noPaths(self):
    """Nothing containing text of package name found in output."""
    # pylint: disable=protected-access
    mock_device = mock.Mock(spec=device_utils.DeviceUtils)
    mock_device.RunShellCommand.configure_mock(
        return_value=[]
    )

    paths = system_app._GetApplicationPaths(mock_device, _PACKAGE_NAME)

    self.assertEquals([], paths)
    mock_device.RunShellCommand.assert_called_once_with(
        _PM_LIST_PACKAGES_COMMAND, check_return=True)