• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tests.create_authorization_header函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.create_authorization_header函数的典型用法代码示例。如果您正苦于以下问题:Python create_authorization_header函数的具体用法?Python create_authorization_header怎么用?Python create_authorization_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_authorization_header函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_user_verify_password_valid_password_resets_failed_logins

def test_user_verify_password_valid_password_resets_failed_logins(notify_api,
                                                                  sample_user):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            data = json.dumps({'password': 'bad password'})
            auth_header = create_authorization_header()

            assert sample_user.failed_login_count == 0

            resp = client.post(
                url_for('user.verify_user_password', user_id=sample_user.id),
                data=data,
                headers=[('Content-Type', 'application/json'), auth_header])
            assert resp.status_code == 400
            json_resp = json.loads(resp.get_data(as_text=True))
            assert 'Incorrect password' in json_resp['message']['password']

            assert sample_user.failed_login_count == 1

            data = json.dumps({'password': 'password'})
            auth_header = create_authorization_header()
            resp = client.post(
                url_for('user.verify_user_password', user_id=sample_user.id),
                data=data,
                headers=[('Content-Type', 'application/json'), auth_header])

            assert resp.status_code == 204
            assert sample_user.failed_login_count == 0
开发者ID:alphagov,项目名称:notifications-api,代码行数:28,代码来源:test_rest_verify.py


示例2: test_api_key_should_create_multiple_new_api_key_for_service

def test_api_key_should_create_multiple_new_api_key_for_service(notify_api, notify_db,
                                                                notify_db_session,
                                                                sample_service):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            assert ApiKey.query.count() == 0
            data = {'name': 'some secret name'}
            auth_header = create_authorization_header(path=url_for('service.renew_api_key',
                                                                   service_id=sample_service.id),
                                                      method='POST',
                                                      request_body=json.dumps(data))
            response = client.post(url_for('service.renew_api_key', service_id=sample_service.id),
                                   data=json.dumps(data),
                                   headers=[('Content-Type', 'application/json'), auth_header])
            assert response.status_code == 201
            assert ApiKey.query.count() == 1
            data = {'name': 'another secret name'}
            auth_header = create_authorization_header(path=url_for('service.renew_api_key',
                                                                   service_id=sample_service.id),
                                                      method='POST',
                                                      request_body=json.dumps(data))
            response2 = client.post(url_for('service.renew_api_key', service_id=sample_service.id),
                                    data=json.dumps(data),
                                    headers=[('Content-Type', 'application/json'), auth_header])
            assert response2.status_code == 201
            assert response2.get_data != response.get_data
            assert ApiKey.query.count() == 2
开发者ID:easternbloc,项目名称:notifications-api,代码行数:27,代码来源:test_api_key_endpoints.py


示例3: test_get_provider_details_by_id

def test_get_provider_details_by_id(client, notify_db):
    response = client.get(
        '/provider-details',
        headers=[create_authorization_header()]
    )
    json_resp = json.loads(response.get_data(as_text=True))['provider_details']

    provider_resp = client.get(
        '/provider-details/{}'.format(json_resp[0]['id']),
        headers=[create_authorization_header()]
    )

    provider = json.loads(provider_resp.get_data(as_text=True))['provider_details']
    assert provider['identifier'] == json_resp[0]['identifier']
开发者ID:alphagov,项目名称:notifications-api,代码行数:14,代码来源:test_rest.py


示例4: test_should_be_able_to_get_all_templates_for_a_service

def test_should_be_able_to_get_all_templates_for_a_service(client, sample_user, sample_service):
    data = {
        'name': 'my template 1',
        'template_type': 'email',
        'subject': 'subject 1',
        'content': 'template content',
        'service': str(sample_service.id),
        'created_by': str(sample_user.id)
    }
    data_1 = json.dumps(data)
    data = {
        'name': 'my template 2',
        'template_type': 'email',
        'subject': 'subject 2',
        'content': 'template content',
        'service': str(sample_service.id),
        'created_by': str(sample_user.id)
    }
    data_2 = json.dumps(data)
    auth_header = create_authorization_header()
    client.post(
        '/service/{}/template'.format(sample_service.id),
        headers=[('Content-Type', 'application/json'), auth_header],
        data=data_1
    )
    auth_header = create_authorization_header()

    client.post(
        '/service/{}/template'.format(sample_service.id),
        headers=[('Content-Type', 'application/json'), auth_header],
        data=data_2
    )

    auth_header = create_authorization_header()

    response = client.get(
        '/service/{}/template'.format(sample_service.id),
        headers=[auth_header]
    )

    assert response.status_code == 200
    update_json_resp = json.loads(response.get_data(as_text=True))
    assert update_json_resp['data'][0]['name'] == 'my template 2'
    assert update_json_resp['data'][0]['version'] == 1
    assert update_json_resp['data'][0]['created_at']
    assert update_json_resp['data'][1]['name'] == 'my template 1'
    assert update_json_resp['data'][1]['version'] == 1
    assert update_json_resp['data'][1]['created_at']
开发者ID:alphagov,项目名称:notifications-api,代码行数:48,代码来源:test_rest.py


示例5: test_get_notifications_for_service_returns_merged_template_content

def test_get_notifications_for_service_returns_merged_template_content(notify_api,
                                                                       notify_db,
                                                                       notify_db_session,
                                                                       sample_template_with_placeholders):
    with freeze_time('2001-01-01T12:00:00'):
        create_sample_notification(notify_db,
                                   notify_db_session,
                                   service=sample_template_with_placeholders.service,
                                   template=sample_template_with_placeholders,
                                   personalisation={"name": "merged with first"})

    with freeze_time('2001-01-01T12:00:01'):
        create_sample_notification(notify_db,
                                   notify_db_session,
                                   service=sample_template_with_placeholders.service,
                                   template=sample_template_with_placeholders,
                                   personalisation={"name": "merged with second"})

    with notify_api.test_request_context():
        with notify_api.test_client() as client:

            auth_header = create_authorization_header(service_id=sample_template_with_placeholders.service_id)

            response = client.get(
                path='/notifications',
                headers=[auth_header])
            assert response.status_code == 200

            assert {noti['body'] for noti in json.loads(response.get_data(as_text=True))['notifications']} == {
                'Hello merged with first\nYour thing is due soon',
                'Hello merged with second\nYour thing is due soon'
            }
开发者ID:alphagov,项目名称:notifications-api,代码行数:32,代码来源:test_rest.py


示例6: test_should_preview_a_single_template

def test_should_preview_a_single_template(
    notify_db,
    client,
    sample_user,
    service_factory,
    subject,
    content,
    path,
    expected_subject,
    expected_content,
    expected_error
):

    template = create_sample_template(
        notify_db, notify_db.session, subject_line=subject, content=content, template_type='email'
    )

    response = client.get(
        path.format(template.service.id, template.id),
        headers=[create_authorization_header()]
    )

    content = json.loads(response.get_data(as_text=True))

    if expected_error:
        assert response.status_code == 400
        assert content['message']['template'] == [expected_error]
    else:
        assert response.status_code == 200
        assert content['content'] == expected_content
        assert content['subject'] == expected_subject
开发者ID:alphagov,项目名称:notifications-api,代码行数:31,代码来源:test_rest.py


示例7: test_user_verify_code_email_bad_code

def test_user_verify_code_email_bad_code(notify_api,
                                         notify_db,
                                         notify_db_session,
                                         sample_admin_service_id,
                                         sample_email_code):
    """
    Tests POST endpoint '/<user_id>/verify/code'
    """
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            assert not VerifyCode.query.first().code_used
            data = json.dumps({
                'code_type': sample_email_code.code_type,
                'code': "blah"})
            auth_header = create_authorization_header(
                service_id=sample_admin_service_id,
                path=url_for('user.verify_user_code', user_id=sample_email_code.user.id),
                method='POST',
                request_body=data)
            resp = client.post(
                url_for('user.verify_user_code', user_id=sample_email_code.user.id),
                data=data,
                headers=[('Content-Type', 'application/json'), auth_header])
            assert resp.status_code == 404
            assert not VerifyCode.query.first().code_used
开发者ID:easternbloc,项目名称:notifications-api,代码行数:25,代码来源:test_rest_verify.py


示例8: test_should_create_a_new_template_for_a_service

def test_should_create_a_new_template_for_a_service(
    client, sample_user, sample_service, template_type, subject
):
    data = {
        'name': 'my template',
        'template_type': template_type,
        'content': 'template <b>content</b>',
        'service': str(sample_service.id),
        'created_by': str(sample_user.id)
    }
    if subject:
        data.update({'subject': subject})
    data = json.dumps(data)
    auth_header = create_authorization_header()

    response = client.post(
        '/service/{}/template'.format(sample_service.id),
        headers=[('Content-Type', 'application/json'), auth_header],
        data=data
    )
    assert response.status_code == 201
    json_resp = json.loads(response.get_data(as_text=True))
    assert json_resp['data']['name'] == 'my template'
    assert json_resp['data']['template_type'] == template_type
    assert json_resp['data']['content'] == 'template content'
    assert json_resp['data']['service'] == str(sample_service.id)
    assert json_resp['data']['id']
    assert json_resp['data']['version'] == 1
    if subject:
        assert json_resp['data']['subject'] == 'subject'
    else:
        assert not json_resp['data']['subject']
开发者ID:alphagov,项目名称:notifications-api,代码行数:32,代码来源:test_rest.py


示例9: test_post_user

def test_post_user(notify_api, notify_db, notify_db_session):
    """
    Tests POST endpoint '/' to create a user.
    """
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            assert User.query.count() == 0
            data = {
                "name": "Test User",
                "email_address": "[email protected]",
                "password": "password",
                "mobile_number": "+447700900986",
                "logged_in_at": None,
                "state": "active",
                "failed_login_count": 0,
                "permissions": {}
            }
            auth_header = create_authorization_header()
            headers = [('Content-Type', 'application/json'), auth_header]
            resp = client.post(
                url_for('user.create_user'),
                data=json.dumps(data),
                headers=headers)
            assert resp.status_code == 201
            user = User.query.filter_by(email_address='[email protected]').first()
            json_resp = json.loads(resp.get_data(as_text=True))
            assert json_resp['data']['email_address'] == user.email_address
            assert json_resp['data']['id'] == str(user.id)
开发者ID:alphagov,项目名称:notifications-api,代码行数:28,代码来源:test_rest.py


示例10: test_send_user_reset_password_should_send_reset_password_link

def test_send_user_reset_password_should_send_reset_password_link(notify_api,
                                                                  sample_user,
                                                                  mocker,
                                                                  password_reset_email_template):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            mocker.patch('notifications_utils.url_safe_token.generate_token', return_value='the-token')
            mocker.patch('uuid.uuid4', return_value='some_uuid')  # for the notification id
            mocker.patch('app.celery.tasks.send_email.apply_async')
            data = json.dumps({'email': sample_user.email_address})
            auth_header = create_authorization_header()
            resp = client.post(
                url_for('user.send_user_reset_password'),
                data=data,
                headers=[('Content-Type', 'application/json'), auth_header])

            message = {
                'template': str(password_reset_email_template.id),
                'template_version': password_reset_email_template.version,
                'to': sample_user.email_address,
                'personalisation': {
                    'user_name': sample_user.name,
                    'url': current_app.config['ADMIN_BASE_URL'] + '/new-password/' + 'the-token'
                }
            }
            assert resp.status_code == 204
            app.celery.tasks.send_email.apply_async.assert_called_once_with(
                [str(current_app.config['NOTIFY_SERVICE_ID']),
                 'some_uuid',
                 app.encryption.encrypt(message),
                 "2016-01-01T11:09:00.061258Z"],
                queue="notify")
开发者ID:alphagov,项目名称:notifications-api,代码行数:32,代码来源:test_rest.py


示例11: test_put_user

def test_put_user(notify_api, notify_db, notify_db_session, sample_service):
    """
    Tests PUT endpoint '/' to update a user.
    """
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            assert User.query.count() == 1
            sample_user = sample_service.users[0]
            new_email = '[email protected]'
            data = {
                'name': sample_user.name,
                'email_address': new_email,
                'mobile_number': sample_user.mobile_number
            }
            auth_header = create_authorization_header()
            headers = [('Content-Type', 'application/json'), auth_header]
            resp = client.put(
                url_for('user.update_user', user_id=sample_user.id),
                data=json.dumps(data),
                headers=headers)
            assert resp.status_code == 200
            assert User.query.count() == 1
            json_resp = json.loads(resp.get_data(as_text=True))
            assert json_resp['data']['email_address'] == new_email
            expected_permissions = default_service_permissions
            fetched = json_resp['data']

            assert str(sample_user.id) == fetched['id']
            assert sample_user.name == fetched['name']
            assert sample_user.mobile_number == fetched['mobile_number']
            assert new_email == fetched['email_address']
            assert sample_user.state == fetched['state']
            assert sorted(expected_permissions) == sorted(fetched['permissions'][str(sample_service.id)])
开发者ID:alphagov,项目名称:notifications-api,代码行数:33,代码来源:test_rest.py


示例12: test_get_all_notifications_filter_by_template_type

def test_get_all_notifications_filter_by_template_type(client, notify_db, notify_db_session):
    email_template = create_sample_template(notify_db, notify_db_session, template_type="email")
    sms_template = create_sample_template(notify_db, notify_db_session, template_type="sms")

    notification = create_sample_notification(
        notify_db, notify_db_session, template=email_template, to_field="[email protected]")
    create_sample_notification(notify_db, notify_db_session, template=sms_template)

    auth_header = create_authorization_header(service_id=notification.service_id)
    response = client.get(
        path='/v2/notifications?template_type=email',
        headers=[('Content-Type', 'application/json'), auth_header])

    json_response = json.loads(response.get_data(as_text=True))

    assert response.status_code == 200
    assert response.headers['Content-type'] == "application/json"
    assert json_response['links']['current'].endswith("/v2/notifications?template_type=email")
    assert 'next' in json_response['links'].keys()
    assert len(json_response['notifications']) == 1

    assert json_response['notifications'][0]['id'] == str(notification.id)
    assert json_response['notifications'][0]['status'] == "created"
    assert json_response['notifications'][0]['template'] == {
        'id': str(email_template.id),
        'uri': email_template.get_link(),
        'version': 1
    }
    assert json_response['notifications'][0]['email_address'] == "[email protected]"
    assert json_response['notifications'][0]['type'] == "email"
开发者ID:alphagov,项目名称:notifications-api,代码行数:30,代码来源:test_get_notifications.py


示例13: test_get_all_notifications_returns_200

def test_get_all_notifications_returns_200(client, notify_db, notify_db_session):
    notifications = [create_sample_notification(notify_db, notify_db_session) for _ in range(2)]
    notification = notifications[-1]

    auth_header = create_authorization_header(service_id=notification.service_id)
    response = client.get(
        path='/v2/notifications',
        headers=[('Content-Type', 'application/json'), auth_header])

    json_response = json.loads(response.get_data(as_text=True))

    assert response.status_code == 200
    assert response.headers['Content-type'] == "application/json"
    assert json_response['links']['current'].endswith("/v2/notifications")
    assert 'next' in json_response['links'].keys()
    assert len(json_response['notifications']) == 2

    assert json_response['notifications'][0]['id'] == str(notification.id)
    assert json_response['notifications'][0]['status'] == "created"
    assert json_response['notifications'][0]['template'] == {
        'id': str(notification.template.id),
        'uri': notification.template.get_link(),
        'version': 1
    }
    assert json_response['notifications'][0]['phone_number'] == "+447700900855"
    assert json_response['notifications'][0]['type'] == "sms"
开发者ID:alphagov,项目名称:notifications-api,代码行数:26,代码来源:test_get_notifications.py


示例14: test_get_whitelist_returns_no_data

def test_get_whitelist_returns_no_data(client, sample_service):
    path = 'service/{}/whitelist'.format(sample_service.id)

    response = client.get(path, headers=[create_authorization_header()])

    assert response.status_code == 200
    assert json.loads(response.get_data(as_text=True)) == {'email_addresses': [], 'phone_numbers': []}
开发者ID:alphagov,项目名称:notifications-api,代码行数:7,代码来源:test_service_whitelist.py


示例15: test_get_api_keys_should_return_all_keys_for_service

def test_get_api_keys_should_return_all_keys_for_service(notify_api, notify_db,
                                                         notify_db_session,
                                                         sample_api_key):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            another_user = create_user(notify_db, notify_db_session, email='[email protected]')

            another_service = create_sample_service(
                notify_db,
                notify_db_session,
                service_name='another',
                user=another_user,
                email_from='another'
            )
            # key for another service
            create_sample_api_key(notify_db, notify_db_session, service=another_service)

            # this service already has one key, add two more, one expired
            create_sample_api_key(notify_db, notify_db_session, service=sample_api_key.service)
            one_to_expire = create_sample_api_key(notify_db, notify_db_session, service=sample_api_key.service)
            expire_api_key(service_id=one_to_expire.service_id, api_key_id=one_to_expire.id)

            assert ApiKey.query.count() == 4

            auth_header = create_authorization_header()
            response = client.get(url_for('service.get_api_keys',
                                          service_id=sample_api_key.service_id),
                                  headers=[('Content-Type', 'application/json'), auth_header])
            assert response.status_code == 200
            json_resp = json.loads(response.get_data(as_text=True))
            assert len(json_resp['apiKeys']) == 3
开发者ID:alphagov,项目名称:notifications-api,代码行数:31,代码来源:test_api_key_endpoints.py


示例16: test_get_all_invited_users_by_service

def test_get_all_invited_users_by_service(notify_api, notify_db, notify_db_session, sample_service):

    from tests.app.conftest import sample_invited_user
    invites = []
    for i in range(0, 5):
        email = 'invited_user_{}@service.gov.uk'.format(i)

        invited_user = sample_invited_user(notify_db,
                                           notify_db_session,
                                           sample_service,
                                           email)
        invites.append(invited_user)

    with notify_api.test_request_context():
        with notify_api.test_client() as client:

            url = '/service/{}/invite'.format(sample_service.id)

            auth_header = create_authorization_header()

            response = client.get(
                url,
                headers=[('Content-Type', 'application/json'), auth_header]
            )
            assert response.status_code == 200
            json_resp = json.loads(response.get_data(as_text=True))

            invite_from = sample_service.users[0]

            for invite in json_resp['data']:
                assert invite['service'] == str(sample_service.id)
                assert invite['from_user'] == str(invite_from.id)
                assert invite['id']
开发者ID:alphagov,项目名称:notifications-api,代码行数:33,代码来源:test_invite_rest.py


示例17: test_create_invited_user_invalid_email

def test_create_invited_user_invalid_email(notify_api, sample_service, mocker):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            mocker.patch('app.celery.tasks.send_email.apply_async')
            email_address = 'notanemail'
            invite_from = sample_service.users[0]

            data = {
                'service': str(sample_service.id),
                'email_address': email_address,
                'from_user': str(invite_from.id),
                'permissions': 'send_messages,manage_service,manage_api_keys'
            }

            data = json.dumps(data)

            auth_header = create_authorization_header()

            response = client.post(
                '/service/{}/invite'.format(sample_service.id),
                headers=[('Content-Type', 'application/json'), auth_header],
                data=data
            )
            assert response.status_code == 400
            json_resp = json.loads(response.get_data(as_text=True))
            assert json_resp['result'] == 'error'
            assert json_resp['message'] == {'email_address': ['Not a valid email address.']}
            app.celery.tasks.send_email.apply_async.assert_not_called()
开发者ID:alphagov,项目名称:notifications-api,代码行数:28,代码来源:test_invite_rest.py


示例18: test_post_email_notification_returns_201

def test_post_email_notification_returns_201(client, sample_email_template_with_placeholders, mocker, reference):
    mocked = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
    data = {
        "email_address": sample_email_template_with_placeholders.service.users[0].email_address,
        "template_id": sample_email_template_with_placeholders.id,
        "personalisation": {"name": "Bob"}
    }
    if reference:
        data.update({"reference": reference})
    auth_header = create_authorization_header(service_id=sample_email_template_with_placeholders.service_id)
    response = client.post(
        path="v2/notifications/email",
        data=json.dumps(data),
        headers=[('Content-Type', 'application/json'), auth_header])
    assert response.status_code == 201
    resp_json = json.loads(response.get_data(as_text=True))
    notification = Notification.query.first()
    assert resp_json['id'] == str(notification.id)
    assert resp_json['reference'] == reference
    assert notification.reference is None
    assert resp_json['content']['body'] == sample_email_template_with_placeholders.content\
        .replace('((name))', 'Bob').replace('GOV.UK', u'GOV.\u200bUK')
    assert resp_json['content']['subject'] == sample_email_template_with_placeholders.subject\
        .replace('((name))', 'Bob')
    assert resp_json['content']['from_email'] == sample_email_template_with_placeholders.service.email_from
    assert 'v2/notifications/{}'.format(notification.id) in resp_json['uri']
    assert resp_json['template']['id'] == str(sample_email_template_with_placeholders.id)
    assert resp_json['template']['version'] == sample_email_template_with_placeholders.version
    assert 'v2/templates/{}'.format(sample_email_template_with_placeholders.id) in resp_json['template']['uri']
    assert mocked.called
开发者ID:alphagov,项目名称:notifications-api,代码行数:30,代码来源:test_post_notifications.py


示例19: test_post_sms_notification_returns_201

def test_post_sms_notification_returns_201(notify_api, sample_template_with_placeholders, mocker, reference):
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
            mocked = mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
            data = {
                'phone_number': '+447700900855',
                'template_id': str(sample_template_with_placeholders.id),
                'personalisation': {' Name': 'Jo'}
            }
            if reference:
                data.update({"reference": reference})
            auth_header = create_authorization_header(service_id=sample_template_with_placeholders.service_id)

            response = client.post(
                path='/v2/notifications/sms',
                data=json.dumps(data),
                headers=[('Content-Type', 'application/json'), auth_header])
            assert response.status_code == 201
            resp_json = json.loads(response.get_data(as_text=True))
            notifications = Notification.query.all()
            assert len(notifications) == 1
            notification_id = notifications[0].id
            assert resp_json['id'] == str(notification_id)
            assert resp_json['reference'] == reference
            assert resp_json['content']['body'] == sample_template_with_placeholders.content.replace("(( Name))", "Jo")
            # conftest fixture service does not have a sms sender, use config default
            assert resp_json['content']['from_number'] == notify_api.config["FROM_NUMBER"]
            assert 'v2/notifications/{}'.format(notification_id) in resp_json['uri']
            assert resp_json['template']['id'] == str(sample_template_with_placeholders.id)
            assert resp_json['template']['version'] == sample_template_with_placeholders.version
            assert 'v2/templates/{}'.format(sample_template_with_placeholders.id) in resp_json['template']['uri']
            assert mocked.called
开发者ID:alphagov,项目名称:notifications-api,代码行数:32,代码来源:test_post_notifications.py


示例20: test_get_all_notifications_filter_by_failed_status

def test_get_all_notifications_filter_by_failed_status(client, notify_db, notify_db_session):
    created_notification = create_sample_notification(notify_db, notify_db_session, status="created")
    failed_notifications = [
        create_sample_notification(notify_db, notify_db_session, status=_status)
        for _status in ["technical-failure", "temporary-failure", "permanent-failure"]
    ]

    auth_header = create_authorization_header(service_id=created_notification.service_id)
    response = client.get(
        path='/v2/notifications?status=failed',
        headers=[('Content-Type', 'application/json'), auth_header])

    json_response = json.loads(response.get_data(as_text=True))

    assert response.status_code == 200
    assert response.headers['Content-type'] == "application/json"
    assert json_response['links']['current'].endswith("/v2/notifications?status=failed")
    assert 'next' in json_response['links'].keys()
    assert len(json_response['notifications']) == 3

    returned_notification_ids = [n['id'] for n in json_response['notifications']]
    for _id in [_notification.id for _notification in failed_notifications]:
        assert str(_id) in returned_notification_ids

    assert created_notification.id not in returned_notification_ids
开发者ID:alphagov,项目名称:notifications-api,代码行数:25,代码来源:test_get_notifications.py



注:本文中的tests.create_authorization_header函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.create_base_items函数代码示例发布时间:2022-05-27
下一篇:
Python tests.clicomm函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap