Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
feat: add success log to disco sync (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharis278 authored Dec 6, 2023
1 parent e81a67e commit 7dac1f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def handle(self, *args, **options):
self.sync_org_groups()
self.sync_program_org_groups()

# load bearing log message. edx.org monitors for this log message
# to know when the sync has run successfully
logger.info('Sync with Discovery Service complete!')

def sync_organizations(self):
"""
Make API call to discovery service and get latest organizations list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ def test_sync_no_change(self):
]
self.assert_organizations(orgs_to_sync, 9)

def test_success_output(self):
orgs_to_sync = [
self.new_discovery_organization,
self.updating_discovery_organization,
self.discovery_other_org,
]
self.mock_get_organizations_patcher.return_value = orgs_to_sync
self.mock_get_programs_by_types_patcher.return_value = []
with patch('registrar.apps.core.management.commands.sync_with_discovery.logger') as mock_logger:
call_command(self.command)
mock_logger.info.assert_called_with('Sync with Discovery Service complete!')


@ddt.ddt
class TestSyncProgramsWithDiscoveryCommand(TestSyncWithDiscoveryCommandBase):
Expand Down

0 comments on commit 7dac1f2

Please sign in to comment.