本文整理汇总了Python中sword2.Connection.load_service_document方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.load_service_document方法的具体用法?Python Connection.load_service_document怎么用?Python Connection.load_service_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sword2.Connection
的用法示例。
在下文中一共展示了Connection.load_service_document方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_03_init_then_load_from_string_t_history
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import load_service_document [as 别名]
def test_03_init_then_load_from_string_t_history(self):
conn = Connection("http://example.org/service-doc")
assert conn.sd_iri == "http://example.org/service-doc"
assert conn.sd == None
conn.load_service_document(long_service_doc)
# Should have made a two client 'transactions', the init and subsequent XML load
assert len(conn.history) == 2
assert conn.history[0]['type'] == "init"
assert conn.history[1]['type'] == "SD Parse"
示例2: test_02_init_then_load_from_string
# 需要导入模块: from sword2 import Connection [as 别名]
# 或者: from sword2.Connection import load_service_document [as 别名]
def test_02_init_then_load_from_string(self):
conn = Connection("http://example.org/service-doc")
assert conn.sd_iri == "http://example.org/service-doc"
assert conn.sd == None
conn.load_service_document(long_service_doc)
assert conn.sd != None
assert len(conn.sd.workspaces) == 2
assert len(conn.workspaces) == 2
assert conn.sd.workspaces[0][0] == "Main Site"
assert conn.sd.workspaces[1][0] == "Sub-site"
assert len(conn.sd.workspaces[1][1]) == 2