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


Python ServiceApi.accept_reject_negotiation方法代码示例

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


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

示例1: accept_reject_negotiation

# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import accept_reject_negotiation [as 别名]
def accept_reject_negotiation():
    negotiation_id = request.form.get('negotiation_id', None)
    verb           = request.form.get('verb', None)
    originator     = request.form.get('originator', None)
    reason         = request.form.get('reason', None)

    resp = ServiceApi.accept_reject_negotiation(negotiation_id, verb, originator, reason)
    return render_json_response(resp)
开发者ID:Bobfrat,项目名称:ion-ux,代码行数:10,代码来源:main.py

示例2: EnrollmentUnitTest

# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import accept_reject_negotiation [as 别名]
class EnrollmentUnitTest(unittest.TestCase):

    def setUp(self):
        self.user = "Owen Ownerrep"
        self.org_name = "RSN Facility"
        self.app_client = main.app.test_client()
        self.app_context = main.app.test_request_context()
        self.sa = ServiceApi()
        self.org_id = get_org_id(org_name=self.org_name)
        self.assertIsNotNone(self.org_id)
        self.assertTrue(is_it_id(self.org_id), "Org id is set to non id value")

    def tearDown(self):
        pass

    def test_enrollment_accept(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)

            # Accept negotiation
            rsp = self.sa.accept_reject_negotiation(negotiation_id, accept, '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_accepted)


            #todo remove the enrollment


    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)
开发者ID:Bobfrat,项目名称:ion-ux,代码行数:93,代码来源:test_request_enrollment.py


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