Skip to content

Commit

Permalink
Only enqueue cleanup if already provisioned
Browse files Browse the repository at this point in the history
  • Loading branch information
bjester committed Nov 16, 2023
1 parent cc8d5bd commit 5c885b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kolibri/core/auth/kolibri_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def handle_initial(self, context):
"""
:type context: morango.sync.context.LocalSessionContext
"""
if context.is_receiver:
from kolibri.core.device.utils import device_provisioned

if context.is_receiver and device_provisioned():
is_pull = context.is_pull
is_push = context.is_push
sync_filter = str(context.filter)
Expand Down
2 changes: 2 additions & 0 deletions kolibri/core/auth/test/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from django.test import TestCase
from morango.sync.context import LocalSessionContext

from .helpers import provision_device
from kolibri.core.auth.kolibri_plugin import AuthSyncHook
from kolibri.core.auth.kolibri_plugin import CleanUpTaskOperation


@mock.patch("kolibri.core.auth.kolibri_plugin.cleanupsync")
class CleanUpTaskOperationTestCase(TestCase):
def setUp(self):
provision_device()
self.context = mock.MagicMock(
spec=LocalSessionContext(),
filter=uuid.uuid4().hex,
Expand Down

0 comments on commit 5c885b3

Please sign in to comment.