def test_client_returns_invite(mocker, sample_invite):

    sample_invite['status'] = 'pending'
    service_id = sample_invite['service']

    expected_data = {'data': [sample_invite]}

    expected_url = '/service/{}/invite'.format(service_id)

    client = InviteApiClient()
    mock_get = mocker.patch('app.notify_client.invite_api_client.InviteApiClient.get', return_value=expected_data)

    invites = client.get_invites_for_service(service_id)

    mock_get.assert_called_once_with(expected_url)
    assert len(invites) == 1
    assert invites[0].status == 'pending'
Пример #2
0
def test_client_returns_invite(mocker, sample_invite):

    sample_invite['status'] = 'pending'
    service_id = sample_invite['service']

    expected_data = {'data': [sample_invite]}

    expected_url = '/service/{}/invite'.format(service_id)

    client = InviteApiClient()
    mock_get = mocker.patch(
        'app.notify_client.invite_api_client.InviteApiClient.get',
        return_value=expected_data)

    invites = client.get_invites_for_service(service_id)

    mock_get.assert_called_once_with(expected_url)
    assert len(invites) == 1
    assert invites[0].status == 'pending'
Пример #3
0
from app.commands import setup_commands
from app.utils import requires_auth
from app.utils import get_cdn_domain
from app.utils import gmt_timezones

login_manager = LoginManager()
csrf = CSRFProtect()

service_api_client = ServiceAPIClient()
user_api_client = UserApiClient()
api_key_api_client = ApiKeyApiClient()
job_api_client = JobApiClient()
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'))