Exemplo n.º 1
0
def create_tp(key=None, secret=None, lp=None, launch_url=None,
              launch_headers=None, tp_class=ToolProvider):
    key = key or generate_client_id()
    secret = secret or generate_token()
    launch_params = LaunchParams()
    if lp is not None:
        launch_params.update(lp)
    launch_url = launch_url or "http://example.edu"
    launch_headers = launch_headers or {}
    return tp_class(key, secret, launch_params, launch_url, launch_headers)
Exemplo n.º 2
0
def create_tp(key=None,
              secret=None,
              lp=None,
              launch_url=None,
              launch_headers=None,
              tp_class=ToolProvider):
    key = key or generate_client_id()
    secret = secret or generate_token()
    launch_params = LaunchParams()
    if lp is not None:
        launch_params.update(lp)
    launch_url = launch_url or "http://example.edu"
    launch_headers = launch_headers or {}
    return tp_class(key, secret, launch_params, launch_url, launch_headers)
Exemplo n.º 3
0
    def test_dict_behavior(self):

        lp = LaunchParams({'lti_version': 'foo', 'lti_message_type': 'bar'})
        self.assertEqual(len(lp), 2)
        lp.update({'resource_link_id': 1})
        self.assertEqual(len(lp), 3)

        self.assertEqual(
            set(lp.keys()),
            {'lti_version', 'lti_message_type', 'resource_link_id'})

        self.assertEqual(dict(lp), {
            'lti_version': 'foo',
            'lti_message_type': 'bar',
            'resource_link_id': 1
        })
Exemplo n.º 4
0
    def test_dict_behavior(self):

        lp = LaunchParams({
            'lti_version': 'foo',
            'lti_message_type': 'bar'
        })
        self.assertEqual(len(lp), 2)
        lp.update({'resource_link_id': 1})
        self.assertEqual(len(lp), 3)

        self.failUnlessRaises(InvalidLaunchParamError, lp.update, {
            'foo': 'bar'
        })

        self.assertEqual(
            set(lp.keys()),
            {'lti_version', 'lti_message_type', 'resource_link_id'}
        )

        self.assertEqual(dict(lp), {
            'lti_version': 'foo',
            'lti_message_type': 'bar',
            'resource_link_id': 1
        })