本文整理汇总了Python中pybonita.BonitaServer类的典型用法代码示例。如果您正苦于以下问题:Python BonitaServer类的具体用法?Python BonitaServer怎么用?Python BonitaServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BonitaServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_modified
def test_modified(self):
""" Update base attributes of a BonitaUser """
user = BonitaUser(username=u'myusername', password=u'mypassword')
user._uuid = 'myuuid'
# Prepare response of MockedServer
url = '/identityAPI/updateUserByUUID'
code = 200
user_xml = build_bonita_user_xml(uuid='myuuid', password='mypassword', username='other_usernames')
BonitaServer.set_response_list([[url, code, user_xml]])
# Modify some base attributes
user.last_name = u'last_name'
user.title = u'Doctor'
user.username = u'other_username'
user.first_name = u'first_name'
user.job_title = u'job_title'
user._update_base_attributes()
assert user.last_name == u'last_name'
assert user.title == u'Doctor'
assert user.username == u'other_username'
assert user.first_name == u'first_name'
assert user.job_title == u'job_title'
dirties = user.get_dirties()
for attribute in user.BASE_ATTRIBUTES:
assert attribute not in dirties
示例2: test_some_users
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'
示例3: test_base_attributes_modified
def test_base_attributes_modified(self):
""" Update BonitaUser base attributes """
user = BonitaUser(username=u'myusername', password=u'mypassword')
user._uuid = 'myuuid'
user.clear()
# Prepare response of MockedServer
url = '/identityAPI/updateUserByUUID'
code = 200
user_xml = build_bonita_user_xml(uuid='myuuid', password='mypassword', username='other_usernames')
BonitaServer.set_response_list([[url, code, user_xml]])
# Modify some base attributes
user.last_name = u'last_name'
user.title = u'Doctor'
user.username = u'other_username'
user.first_name = u'first_name'
user.job_title = u'job_title'
user._update()
assert user.is_modified is False
assert user.last_name == u'last_name'
assert user.title == u'Doctor'
assert user.username == u'other_username'
assert user.first_name == u'first_name'
assert user.job_title == u'job_title'
示例4: test_unknown_role
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
示例5: test_unknown_user
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
示例6: test_unknown_membership
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
示例7: test_unknown_group
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
示例8: test_unknown_role
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
示例9: test_not_found_user_by_uuid
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
示例10: test_not_found_group_by_uuid
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
示例11: test_not_found_process
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
示例12: test_get_group_by_path
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_get_role_by_name
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'
示例14: test_known_group
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'
示例15: test_fresh_user
def test_fresh_user(self):
""" Save a freshly create BonitaUser """
user = BonitaUser(username=u'myusername', password=u'mypassword')
url = '/identityAPI/addUser'
code = 204
user_xml = build_bonita_user_xml(uuid='myuuid', password='mypassword', username='myusername')
BonitaServer.set_response_list([[url, code, user_xml]])
user._create()
assert user.is_modified is False
assert user.uuid == 'myuuid'