示例#1
0
    def test_post_response_valid_xml(self):
        """
        Test post grade with valid XML response
        """
        uri = 'https://localhost:8000/dev_stack'

        def request_callback(request, cburi, headers):
            # pylint: disable=unused-argument,
            """
            Mock expected response.
            """
            return 200, headers, self.expected_response

        httpretty.register_uri(httpretty.POST, uri, body=request_callback)
        consumers = {
            "__consumer_key__": {
                "secret": "__lti_secret__",
                "cert": TEST_CLIENT_CERT,
            },
        }
        body = generate_request_xml('message_identifier_id', 'operation',
                                    'lis_result_sourcedid', '1.0')
        ret = post_message(consumers, "__consumer_key__", uri, body)
        self.assertTrue(ret)

        ret = post_message2(consumers, "__consumer_key__", uri, body)
        self.assertTrue(ret)
示例#2
0
    def test_post_response_valid_xml(self):
        """
        Test post grade with valid XML response
        """
        uri = 'https://localhost:8000/dev_stack'

        def request_callback(request, cburi, headers):
            # pylint: disable=unused-argument,
            """
            Mock expected response.
            """
            return 200, headers, self.expected_response

        httpretty.register_uri(httpretty.POST, uri, body=request_callback)
        consumers = {
            "__consumer_key__": {
                "secret": "__lti_secret__",
                "cert": TEST_CLIENT_CERT,
            },
        }
        body = generate_request_xml('message_identifier_id', 'operation',
                                    'lis_result_sourcedid', '1.0')
        ret = post_message(consumers, "__consumer_key__", uri, body)
        self.assertTrue(ret)

        ret = post_message2(consumers, "__consumer_key__", uri, body)
        self.assertTrue(ret)