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

feat: add success log to disco sync #584

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading