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

Python tests.get_prefixed_url函数代码示例

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

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



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

示例1: step_impl_we_delete_file

def step_impl_we_delete_file(context):
    url = '/upload/%s' % context.fetched_data['_id']
    context.headers.append(('Accept', 'application/json'))
    headers = if_match(context, context.fetched_data.get('_etag'))
    response = context.client.delete(get_prefixed_url(context.app, url), headers=headers)
    assert_200(response)
    response = context.client.get(get_prefixed_url(context.app, url), headers=headers)
    assert_404(response)
开发者ID:vied12,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例2: patch_current_user

def patch_current_user(context, data):
    response = context.client.get(get_prefixed_url(context.app, '/users/%s' % context.user['_id']),
                                  headers=context.headers)
    user = json.loads(response.get_data())
    headers = if_match(context, user.get('_etag'))
    response = context.client.patch(get_prefixed_url(context.app, '/users/%s' % context.user['_id']),
                                    data=data, headers=headers)
    assert_ok(response)
    return response
开发者ID:vied12,项目名称:superdesk-server,代码行数:9,代码来源:steps.py


示例3: step_impl_when_delete_url

def step_impl_when_delete_url(context, url):
    url = apply_placeholders(context, url)
    res = get_res(url, context)
    href = get_self_href(res, context)
    headers = if_match(context, res.get('_etag'))
    href = get_prefixed_url(context.app, href)
    context.response = context.client.delete(href, headers=headers)
开发者ID:plaindocs,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例4: steo_impl_we_get_latest

def steo_impl_we_get_latest(context):
    data = get_json_data(context.response)
    href = get_self_href(data, context)
    headers = if_match(context, data.get('_etag'))
    href = get_prefixed_url(context.app, href)
    context.response = context.client.get(href, headers=headers)
    assert_200(context.response)
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例5: when_we_create_highglights_package

def when_we_create_highglights_package(context):
    data_text = '{"highlight": "%s", "type": "composite", ' \
                '"task": {"user": "#user._id#", "desk": "#desks._id#"}}' \
                % str(context.highlights['_id'])
    data_text = apply_placeholders(context, data_text)
    url = get_prefixed_url(context.app, '/archive')
    context.response = context.client.post(url, data=data_text, headers=context.headers)
开发者ID:hlmnrmr,项目名称:superdesk-core,代码行数:7,代码来源:highlights_steps.py


示例6: step_impl_when_restore_version

def step_impl_when_restore_version(context, version):
    data = get_json_data(context.response)
    href = get_self_href(data, context)
    headers = if_match(context, data.get('_etag'))
    text = '{"type": "text", "old_version": %s, "last_version": %s}' % (version, data.get('_version'))
    context.response = context.client.put(get_prefixed_url(context.app, href), data=text, headers=headers)
    assert_ok(context.response)
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例7: we_can_fetch_a_file

def we_can_fetch_a_file(context, url, mimetype):
    headers = [('Accept', 'application/json')]
    headers = unique_headers(headers, context.headers)
    response = context.client.get(get_prefixed_url(context.app, url), headers=headers)
    assert_200(response)
    assert len(response.get_data()), response
    assert response.mimetype == mimetype, response.mimetype
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例8: step_impl_when_patch

def step_impl_when_patch(context):
    with context.app.mail.record_messages() as outbox:
        href, etag = get_it(context)
        headers = if_match(context, etag)
        context.response = context.client.patch(get_prefixed_url(context.app, href), data=context.text, headers=headers)
        assert_ok(context.response)
        context.outbox = outbox
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例9: step_impl_then_get_etag

def step_impl_then_get_etag(context, url):
    if context.app.config['IF_MATCH']:
        assert_200(context.response)
        expect_json_contains(context.response, '_etag')
        etag = get_json_data(context.response).get('_etag')
        response = context.client.get(get_prefixed_url(context.app, url), headers=context.headers)
        expect_json_contains(response, {'_etag': etag})
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例10: start_reset_password_for_user

def start_reset_password_for_user(context):
    data = {'token': context.token, 'password': 'test_pass'}
    headers = [('Content-Type', 'multipart/form-data')]
    headers = unique_headers(headers, context.headers)
    context.response = context.client.post(get_prefixed_url(context.app, '/reset_user_password'),
                                           data=data, headers=headers)
    print(context.response.get_data())
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:7,代码来源:steps.py


示例11: step_impl_when_put_url

def step_impl_when_put_url(context, url):
    with context.app.mail.record_messages() as outbox:
        data = apply_placeholders(context, context.text)
        href = get_self_href(url)
        context.response = context.client.put(get_prefixed_url(context.app, href), data=data, headers=context.headers)
        assert_ok(context.response)
        context.outbox = outbox
开发者ID:vied12,项目名称:superdesk-server,代码行数:7,代码来源:steps.py


示例12: step_impl_when_patch_url

def step_impl_when_patch_url(context, url):
    url = apply_placeholders(context, url)
    res = get_res(url, context)
    href = get_self_href(res, context)
    headers = if_match(context, res.get('_etag'))
    data = apply_placeholders(context, context.text)
    context.response = context.client.patch(get_prefixed_url(context.app, href), data=data, headers=headers)
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:7,代码来源:steps.py


示例13: when_we_delete_it

def when_we_delete_it(context):
    with context.app.mail.record_messages() as outbox:
        res = get_json_data(context.response)
        href = get_self_href(res, context)
        headers = if_match(context, res.get('_etag'))
        href = get_prefixed_url(context.app, href)
        context.response = context.client.delete(href, headers=headers)
        context.email = outbox
开发者ID:vied12,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例14: step_impl_when_post_url

def step_impl_when_post_url(context, url):
    data = apply_placeholders(context, context.text)
    if url in ('/users', 'users'):
        user = json.loads(data)
        user.setdefault('needs_activation', False)
        data = json.dumps(user)
    context.response = context.client.post(get_prefixed_url(context.app, url), data=data, headers=context.headers)
    store_placeholder(context, url)
开发者ID:plaindocs,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例15: step_role_extends

def step_role_extends(context, extending_name, extended_name):
    with context.app.test_request_context(context.app.config['URL_PREFIX']):
        extended = get_resource_service('roles').find_one(name=extended_name, req=None)
        extending = get_resource_service('roles').find_one(name=extending_name, req=None)
        headers = if_match(context, extending.get('_etag'))
        data = json.dumps({'extends': str(extended['_id'])})
        context.response = context.client.patch(get_prefixed_url(context.app, '/roles/%s' % extending['_id']),
                                                data=data, headers=headers)
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:8,代码来源:steps.py


示例16: we_get_embedded_items

def we_get_embedded_items(context):
    response_data = json.loads(context.response.get_data())
    href = get_self_href(response_data, context)
    url = href + '/?embedded={"items": 1}'
    context.response = context.client.get(get_prefixed_url(context.app, url), headers=context.headers)
    assert_200(context.response)
    context.response_data = json.loads(context.response.get_data())
    assert len(context.response_data['items']['view_items']) == 2
开发者ID:vied12,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例17: step_create_a_user

def step_create_a_user(context):
    data = apply_placeholders(context, context.text)
    with context.app.mail.record_messages() as outbox:
        context.response = context.client.post(get_prefixed_url(context.app, '/users'),
                                               data=data, headers=context.headers)
        expect_status_in(context.response, (200, 201))
        assert len(outbox) == 1
        context.email = outbox[0]
开发者ID:vied12,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例18: step_impl_then_get_archive_ingest_result

def step_impl_then_get_archive_ingest_result(context):
    assert_200(context.response)
    expect_json_contains(context.response, 'task_id')
    item = json.loads(context.response.get_data())
    url = '/archive_ingest/%s' % (item['task_id'])
    context.response = context.client.get(get_prefixed_url(context.app, url), headers=context.headers)
    assert_200(context.response)
    test_json(context)
开发者ID:vied12,项目名称:superdesk-server,代码行数:8,代码来源:steps.py


示例19: step_impl_when_post_url_with_success

def step_impl_when_post_url_with_success(context, url):
    data = apply_placeholders(context, context.text)
    context.response = context.client.post(get_prefixed_url(context.app, url), data=data, headers=context.headers)
    assert_ok(context.response)
    item = json.loads(context.response.get_data())
    if item.get('_id'):
        parsed_url = urlparse(url)
        name = basename(parsed_url.path)
        set_placeholder(context, '%s_ID' % name.upper(), item['_id'])
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:9,代码来源:steps.py


示例20: upload_file

def upload_file(context, dest, filename, crop_data=None):
    with open(get_fixture_path(filename), 'rb') as f:
        data = {'media': f}
        if crop_data:
            data.update(crop_data)
        headers = [('Content-Type', 'multipart/form-data')]
        headers = unique_headers(headers, context.headers)
        context.response = context.client.post(get_prefixed_url(context.app, dest), data=data, headers=headers)
        assert_ok(context.response)
开发者ID:nistormihai,项目名称:liveblog-server,代码行数:9,代码来源:steps.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tests.setup函数代码示例发布时间:2022-05-27
下一篇:
Python resource.Resource类代码示例发布时间: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