Mock HttpRequestManager while changing sync state

This change triggers a cascade of updates and in some cases triggers a sync. The sync trigger also triggers an update of the account permissions which crashes because the HttpRequestManager can't be started on a thread. We shouldn't make HTTP requests from our tests anyway so mock this away.

Contributes to issue CURA-9220.
This commit is contained in:
Ghostkeeper 2022-07-27 11:43:31 +02:00
parent d52be42e01
commit 37a98cbb6f
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -93,6 +93,7 @@ def test_sync_success():
service1 = "test_service1"
service2 = "test_service2"
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance"): # Don't want triggers for account information to actually make HTTP requests.
account.setSyncState(service1, SyncState.SYNCING)
assert account.syncState == SyncState.SYNCING
@ -114,6 +115,7 @@ def test_sync_update_action():
mockUpdateCallback = MagicMock()
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance"): # Don't want triggers for account information to actually make HTTP requests.
account.setSyncState(service1, SyncState.SYNCING)
assert account.syncState == SyncState.SYNCING