Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Nov 11, 2021
1 parent d3d976c commit 46df16b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from tribler_common.sentry_reporter import sentry_reporter
from tribler_common.sentry_reporter.sentry_reporter import SentryReporter

from tribler_core.components.reporter.exception_handler import CoreExceptionHandler

pytestmark = pytest.mark.asyncio
Expand Down
6 changes: 3 additions & 3 deletions src/tribler-core/tribler_core/tests/test_start_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from tribler_core.components.reporter.exception_handler import CoreExceptionHandler
from tribler_core.settings import ErrorHandlingSettings
from tribler_core.start_core import start_tribler_core

Expand All @@ -24,11 +23,12 @@ class MockedProcessChecker(MagicMock):
@patch('tribler_core.start_core.ProcessChecker', new=MockedProcessChecker())
@patch('asyncio.get_event_loop', new=MagicMock())
@patch('tribler_core.start_core.TriblerConfig.load')
async def test_start_tribler_core_requires_user_consent(mocked_config):
@patch('tribler_core.start_core.default_core_exception_handler')
async def test_start_tribler_core_requires_user_consent(mocked_core_exception_handler, mocked_config):
# test that CoreExceptionHandler sets `requires_user_consent` in regarding the Tribler's config
class MockedTriblerConfig(MagicMock):
error_handling = ErrorHandlingSettings(core_error_reporting_requires_user_consent=False)

mocked_config.return_value = MockedTriblerConfig()
start_tribler_core('.', 1, 'key', '.', False)
assert not CoreExceptionHandler.requires_user_consent
assert mocked_core_exception_handler.requires_user_consent == False

0 comments on commit 46df16b

Please sign in to comment.