def test_unknown_task(self): """ When the task is unknown the hostname should be None. """ headers = {} body = {} tenant_context_addition("uknown_task", headers=headers, body=body) self.assertIsNone(headers['eox_tenant_sender'])
def test_sync_process_with_tenant(self): """ When the task is called from a sync proccess it is used the value of the 'host' key in the request dict. """ headers = {} body = {} with self.settings(EDNX_TENANT_DOMAIN="some.tenant.com"): tenant_context_addition("some.task", headers=headers, body=body) self.assertEqual(headers['eox_tenant_sender'], 'some.tenant.com')
def test_send_recurring_nudge(self, _get_host_mock): """ When the task is called the method get_host_from_siteid should be called. """ headers = {} body = {} with self.settings(): tenant_context_addition( "openedx.core.djangoapps.schedules.tasks.ScheduleRecurringNudge", headers=headers, body=body, ) _get_host_mock.assert_called()