本文整理汇总了Python中pybonita.BonitaServer.use方法的典型用法代码示例。如果您正苦于以下问题:Python BonitaServer.use方法的具体用法?Python BonitaServer.use怎么用?Python BonitaServer.use使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybonita.BonitaServer
的用法示例。
在下文中一共展示了BonitaServer.use方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_some_users
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_some_users(self):
""" Retrieve all users for a role """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getAllUsersInRoleAndGroup'
code = 200
user1_xml = build_bonita_user_xml(uuid='1234', password='', username='user1')
user2_xml = build_bonita_user_xml(uuid='6789', password='', username='user2')
xml = build_xml_list([user1_xml, user2_xml])
BonitaServer.set_response_list([[url, code, xml]])
role = BonitaRole('myrole', '', '')
role.uuid = '1234'
group = BonitaGroup('mygroup', '', '')
group.uuid = '2345'
users = BonitaUser.find_by_role_and_group(role, group)
assert isinstance(users, list)
assert len(users) == 2
for user in users:
assert isinstance(user, BonitaUser)
sorted_users = sorted(users, key=lambda user: user.uuid)
assert sorted_users[0].uuid == u'1234'
assert sorted_users[1].uuid == u'6789'
示例2: test_unknown_role
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_unknown_role(self):
""" Try to retrieve membership by role and group UUID : no role matching given UUID"""
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getMembershipForRoleAndGroup'
code = 500
xml = build_dumb_bonita_error_body('RoleNotFoundException',message='can\'t find Role : unknown')
BonitaServer.set_response_list([[url,code,xml]])
membership = BonitaMembership.get_by_role_and_group_uuid(role_uuid='unknown',group_uuid='group-14')
assert membership == None
示例3: test_unknown_group
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_unknown_group(self):
""" Try to retrieve group by path but no group matching """
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getGroupUsingPath'
code = 500
xml = build_dumb_bonita_error_body('GroupNotFoundException',message='can\'t find Group: unknown')
BonitaServer.set_response_list([[url,code,xml]])
group = BonitaGroup.get_by_path('/something/unknown')
assert group == None
示例4: test_unknown_user
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_unknown_user(self):
""" Try to retrieve user by UUID but no user matching """
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getUserByUUID'
code = 500
xml = build_dumb_bonita_error_body('UserNotFoundException', message='can\'t find User: unknown')
BonitaServer.set_response_list([[url, code, xml]])
user = BonitaUser.get_by_uuid('unknown')
assert user is None
示例5: test_unknown_membership
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_unknown_membership(self):
""" Try to retrieve membership by UUID but no membership matching """
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getMembershipByUUID'
code = 500
xml = build_dumb_bonita_error_body('MembershipNotFoundException',message='can\'t find Membership : unknown')
BonitaServer.set_response_list([[url,code,xml]])
membership = BonitaMembership.get_by_uuid('unknown')
assert membership == None
示例6: test_unknown_role
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_unknown_role(self):
""" Try to retrieve role by UUID but no role matching """
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getRoleByUUID'
code = 500
xml = build_dumb_bonita_error_body('RoleNotFoundException',message='can\'t find Role: unknown')
BonitaServer.set_response_list([[url,code,xml]])
role = BonitaRole.get_by_uuid('unknown')
assert role == None
示例7: test_not_found_process
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_not_found_process(self):
""" Retrieve not existing process """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/queryDefinitionAPI/getProcess/MonProcessus1--1.0'
code = 500
xml = build_dumb_bonita_error_body('ProcessNotFoundException',message='Bonita Error: bai_QDAPII_5\nCan\'t find a process with uuid MonProcessus1--1.0')
BonitaServer.set_response_list([[url,code,xml]])
process = BonitaProcess.get('MonProcessus1--1.0')
assert process == None
示例8: test_not_found_user_by_uuid
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_not_found_user_by_uuid(self):
""" Try to retrieve user but nothing found with given key """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getUserByUUID'
code = 500
xml = build_dumb_bonita_error_body('UserNotFoundException', message='can\'t find User: not found uuid')
BonitaServer.set_response_list([[url, code, xml]])
user = BonitaUser.get(uuid='not found uuid')
assert user is None
示例9: test_not_found_group_by_uuid
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_not_found_group_by_uuid(self):
""" Try to retrieve group but nothing found with given key """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getGroupByUUID'
code = 500
xml = build_dumb_bonita_error_body('GroupNotFoundException',message='can\'t find Group: unknown')
BonitaServer.set_response_list([[url,code,xml]])
group = BonitaGroup.get(uuid='unknown')
assert group == None
示例10: test_no_user
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_no_user(self):
""" Retrieve all users but there are none """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getUsers'
code = 200
xml = build_xml_set([])
BonitaServer.set_response_list([[url, code, xml]])
users = BonitaUser.find_all()
assert isinstance(users, list)
assert len(users) == 0
示例11: test_known_user
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_known_user(self):
""" Retrieve a user using the UUID """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getUserByUUID'
code = 200
xml = build_bonita_user_xml(uuid='996633', password='', username='username')
BonitaServer.set_response_list([[url, code, xml]])
user = BonitaUser.get_by_uuid('996633')
assert isinstance(user, BonitaUser)
assert user.uuid == '996633'
示例12: test_get_group_by_path
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_get_group_by_path(self):
""" Retrieve a group with path """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getGroupUsingPath'
code = 200
xml = build_bonita_group_xml(uuid='996633',name='mygroup')
BonitaServer.set_response_list([[url,code,xml]])
group = BonitaGroup.get(path='/mygroup')
assert isinstance(group,BonitaGroup)
assert group.name == 'mygroup'
示例13: test_known_group
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_known_group(self):
""" Retrieve a group using the UUID """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getGroupByUUID'
code = 200
xml = build_bonita_group_xml(uuid='996633',name='mygroup')
BonitaServer.set_response_list([[url,code,xml]])
group = BonitaGroup.get_by_uuid('996633')
assert isinstance(group,BonitaGroup)
assert group.uuid == '996633'
示例14: test_get_role_by_name
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_get_role_by_name(self):
""" Retrieve a role with name """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getRole'
code = 200
xml = build_bonita_role_xml(uuid='996633',name='myrole')
BonitaServer.set_response_list([[url,code,xml]])
role = BonitaRole.get(name='myrole')
assert isinstance(role,BonitaRole)
assert role.name == 'myrole'
示例15: test_root_group
# 需要导入模块: from pybonita import BonitaServer [as 别名]
# 或者: from pybonita.BonitaServer import use [as 别名]
def test_root_group(self):
""" Retrieve root group : /platform """
# Setup the response for MockServer
BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')
url = '/identityAPI/getGroupUsingPath'
code = 200
xml = build_bonita_group_xml(uuid='996633',name='platform')
BonitaServer.set_response_list([[url,code,xml]])
group = BonitaGroup.get_default_root()
assert isinstance(group,BonitaGroup)
assert group.name == u'platform'
assert group.parent is None