def test_order_info(self, settings): """ Test the order info template. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() notify.order_info(OrderFactory(), what_happened='', why='')
def test_you_have_been_removed_for_adviser(self, settings): """ Test the notification for when an adviser is removed from an order. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() order = OrderFactory() notify.adviser_removed(order=order, adviser=AdviserFactory())
def test_quote_cancelled(self, settings): """ Test templates of quote cancelled for customer and advisers. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() order = OrderWithOpenQuoteFactory() notify.quote_cancelled(order, by=AdviserFactory())
def test_order_completed(self, settings): """ Test templates of order completed for advisers. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() order = OrderCompleteFactory() notify.order_completed(order)
def test_you_have_been_added_for_adviser(self, settings): """ Test the notification for when an adviser is added to an order. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() order = OrderFactory() notify.adviser_added( order=order, adviser=AdviserFactory(), by=AdviserFactory(), creation_date=dateutil_parse('2017-05-18'), )
def test_order_created(self, settings): """ Test the order created template. If the template variables have been changed in GOV.UK notifications this is going to raise HTTPError (400 - Bad Request). """ settings.OMIS_NOTIFICATION_API_KEY = settings.OMIS_NOTIFICATION_TEST_API_KEY notify = Notify() market = Market.objects.first() market.manager_email = '*****@*****.**' market.save() UKRegionalSettings.objects.create( uk_region_id=UKRegion.london.value.id, manager_emails=['*****@*****.**'], ) order = OrderFactory( primary_market_id=market.country.pk, uk_region_id=UKRegion.london.value.id, ) notify.order_created(order)
def end_to_end_notify(monkeypatch, settings): """ A fixture for a notify client which uses the new datahub.notification app under the hood and calls through to the GOVUK notify service (with settings.OMIS_NOTIFICATION_TEST_API_KEY). By contrast, our other test cases will use mocked clients so that no actual web requests are made to GOVUK notify. """ with override_settings(OMIS_NOTIFICATION_API_KEY=settings.OMIS_NOTIFICATION_TEST_API_KEY): monkeypatch.setattr( 'datahub.notification.tasks.notify_gateway', NotifyGateway(), ) FeatureFlagFactory(code=OMIS_USE_NOTIFICATION_APP_FEATURE_FLAG_NAME) yield Notify()