本文整理汇总了Python中service_api.ServiceApi.enroll_request方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceApi.enroll_request方法的具体用法?Python ServiceApi.enroll_request怎么用?Python ServiceApi.enroll_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service_api.ServiceApi
的用法示例。
在下文中一共展示了ServiceApi.enroll_request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_enrollment_reject
# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import enroll_request [as 别名]
def test_enrollment_reject(self):
negotiation_open = 1
negotiation_accepted = 2
negotiation_rejected = 3
reject = 'reject'
accept = 'accept'
negotiation_type_request = 1
# Request access to RSN Facility
with self.app_context:
self.sa.signon_user_testmode(self.user)
actor_id = flask.session.get('actor_id') if flask.session.has_key('actor_id') else None
resp = ServiceApi.enroll_request(self.org_id, actor_id)
error = resp.get('GatewayError')
self.assertIsNone(error, "Request for enrollment failed. Error: " + str(error))
negotiation_id = resp.get('negotiation_id')
self.assertIsNotNone(negotiation_id, "Request for enrollment failed ")
with self.app_context:
# Verify negotiation is open
self.sa.signon_user_testmode("Tim Ampe")
resource = self.sa.get_prepare("OrgUserNegotiationRequest", negotiation_id, None, True)
resource_obj = resource.get('resource')
negotiation_status = resource_obj.get('negotiation_status')
negotiation_type = resource_obj.get('negotiation_type')
self.assertEqual(negotiation_status, negotiation_open)
self.assertEqual(negotiation_type, negotiation_type_request)
# Reject negotiation
rsp = self.sa.accept_reject_negotiation(negotiation_id, reject, 'provider', 'Different roads sometimes lead to the same castle.')
resource = self.sa.get_prepare("OrgUserNegotiationRequest", negotiation_id, None, True)
resource_obj = resource.get('resource')
negotiation_status = resource_obj.get('negotiation_status')
negotiation_type = resource_obj.get('negotiation_type')
self.assertEqual(negotiation_status, negotiation_rejected)
示例2: enroll_request
# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import enroll_request [as 别名]
def enroll_request(resource_type, resource_id):
actor_id = session.get('actor_id') if session.has_key('actor_id') else None
resp = ServiceApi.enroll_request(resource_id, actor_id)
return render_json_response(resp)