def test_get_free_sms_fragment_limit_for_year_correct_endpoint(mocker, api_user_active): service_id = uuid.uuid4() expected_url = "/service/{}/billing/free-sms-fragment-limit".format(service_id) client = BillingAPIClient() mock_get = mocker.patch("app.notify_client.billing_api_client.BillingAPIClient.get") client.get_free_sms_fragment_limit_for_year(service_id, year=1999) mock_get.assert_called_once_with(expected_url, params={"financial_year_start": 1999})
def test_get_billing_units_calls_correct_endpoint(mocker, api_user_active): service_id = uuid.uuid4() expected_url = '/service/{}/billing/monthly-usage'.format(service_id) client = BillingAPIClient() mock_get = mocker.patch('app.notify_client.billing_api_client.BillingAPIClient.get') client.get_billable_units(service_id, 2017) mock_get.assert_called_once_with(expected_url, params={'year': 2017})
def test_post_free_sms_fragment_limit_for_year_endpoint(mocker, api_user_active): service_id = uuid.uuid4() sms_limit_data = {"free_sms_fragment_limit": 1111, "financial_year_start": 2017} mock_post = mocker.patch("app.notify_client.billing_api_client.BillingAPIClient.post") client = BillingAPIClient() client.create_or_update_free_sms_fragment_limit(service_id=service_id, free_sms_fragment_limit=1111, year=2017) mock_post.assert_called_once_with( url="/service/{}/billing/free-sms-fragment-limit".format(service_id), data=sms_limit_data, )
def test_post_free_sms_fragment_limit_for_current_year_endpoint(mocker, api_user_active): service_id = uuid.uuid4() sms_limit_data = {'free_sms_fragment_limit': 1111, 'financial_year_start': None} mock_post = mocker.patch('app.notify_client.billing_api_client.BillingAPIClient.post') client = BillingAPIClient() client.create_or_update_free_sms_fragment_limit(service_id=service_id, free_sms_fragment_limit=1111) mock_post.assert_called_once_with( url='/service/{}/billing/free-sms-fragment-limit'.format(service_id), data=sms_limit_data )
notification_api_client = NotificationApiClient() support_api_client = SupportApiClient() status_api_client = StatusApiClient() invite_api_client = InviteApiClient() template_statistics_client = TemplateStatisticsApiClient() events_api_client = EventsApiClient() provider_client = ProviderClient() email_branding_client = EmailBrandingClient() organisations_client = OrganisationsClient() org_invite_api_client = OrgInviteApiClient() asset_fingerprinter = AssetFingerprinter() statsd_client = StatsdClient() deskpro_client = DeskproClient() letter_jobs_client = LetterJobsClient() inbound_number_client = InboundNumberClient() billing_api_client = BillingAPIClient() # The current service attached to the request stack. current_service = LocalProxy(partial(_lookup_req_object, 'service')) # The current organisation attached to the request stack. current_organisation = LocalProxy(partial(_lookup_req_object, 'organisation')) def create_app(application): setup_commands(application) notify_environment = os.environ['NOTIFY_ENVIRONMENT'] application.config.from_object(configs[notify_environment])