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


Python MagicMock.fullpath方法代码示例

本文整理汇总了Python中mock.mock.MagicMock.fullpath方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.fullpath方法的具体用法?Python MagicMock.fullpath怎么用?Python MagicMock.fullpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mock.mock.MagicMock的用法示例。


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

示例1: test_rss

# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import fullpath [as 别名]
def test_rss(container_node, other_container_node, content_node, collections, home_root, guest_user, root):

    everybody_rule = get_or_add_everybody_rule()

    root.children.append(collections)

    collections.access_rule_assocs.append(NodeToAccessRule(ruletype=u"read", rule=everybody_rule))
    collections.container_children.append(container_node)

    container_node.container_children.append(other_container_node)
    other_container_node.content_children.append(content_node)

    struct = {"nodelist": [other_container_node, content_node], "build_response_start": time.time()}
    params = {}
    req = MagicMock()
    req.get_header = lambda x: "localhost:8081"
    req.fullpath = ""
    req.query = ""

    res = struct2rss(req, "", params, None, struct=struct)
    print res
    # TODO: find some way to check XML content properly
    assert res.startswith("""<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>""")
    assert "document/testschema" in res
    assert "http://localhost:8081/node?id=" in res
开发者ID:mediatum,项目名称:mediatum,代码行数:29,代码来源:test_handlers.py

示例2: xml_fixture

# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import fullpath [as 别名]
def xml_fixture(parent_node, content_node):
    global mock
    parent_node["testvalue"] = "1001"
    content_node["testvalue"] = "1002"
    struct = {"nodelist": [parent_node, content_node],
              "build_response_start": time.time(),
              "status": "ok",
              "dataready": "0.1",
              "retrievaldate": datetime.datetime.now().isoformat(),
              "sortfield": "sortfield",
              "sortdirection": "up",
              "timetable": [],
              "result_shortlist": []}
    params = {}
    if not mock:
        req = MagicMock()
        mock = req
    else:
        req = mock
    req.get_header = lambda x: "localhost:8081"
    req.fullpath = ""
    req.query = ""

    MetadatatypeFactory(name=u"directory")
    MetadatatypeFactory(name=u"testschema")

    return struct, req, params
开发者ID:mediatum,项目名称:mediatum,代码行数:29,代码来源:test_handlers.py


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