当前位置: 首页>>代码示例>>Python>>正文


Python tests.get_prefixed_url函数代码示例

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


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


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