Пример #1
0
 def test_read_xml_config(self):
     '''
     Should read an XML config.
     '''
     config = ToolConfig.create_from_xml(CC_LTI_XML)
     self.assertEqual(normalize_xml(config.to_xml()),
                      normalize_xml(CC_LTI_XML))
Пример #2
0
    def test_generate_xml(self):
        '''
        Should generate the expected config xml.
        '''
        config = ToolConfig(title="Test Config",
                            secure_launch_url="https://www.example.com/lti",
                            custom_params={"custom1": "customval1"})
        config.description = 'Description of boringness'
        config.launch_url = 'http://www.example.com/lti'
        config.icon = 'http://wil.to/_/beardslap.gif'
        config.vendor_code = 'test'
        config.vendor_name = 'test.tool'
        config.vendor_description = 'We test things'
        config.vendor_url = 'http://www.example.com/about'
        config.vendor_contact_email = '*****@*****.**'
        config.vendor_contact_name = 'Joe Support'

        config.set_custom_param('custom2', 'customval2')

        config.set_ext_params('example.com', {'extkey1': 'extval1'})
        config.set_ext_param('example.com', 'extkey2', 'extval2')
        config.set_ext_param('example.com', 'extopt1', {
            'optkey1': 'optval1',
            'optkey2': 'optval2'
        })
        config.set_ext_param('two.example.com', 'ext1key', 'ext1val')

        config.cartridge_bundle = 'BLTI001_Bundle'

        correct = normalize_xml(CC_LTI_XML)
        got = normalize_xml(config.to_xml())
        self.assertEqual(got, correct)
Пример #3
0
 def test_invalid_config_xml(self):
     '''
     Should not allow creating invalid config xml.
     '''
     config = ToolConfig(title='Test Config')
     self.assertRaises(InvalidLTIConfigError, config.to_xml)
Пример #4
0
    def test_allow_suboptions(self):

        config = ToolConfig(title="Test Config",
                            secure_launch_url="https://www.example.com/lti",
                            custom_params={"custom1": "customval1"})
        config.description = 'Description of boringness'
        config.launch_url = 'http://www.example.com/lti'
        config.icon = 'http://wil.to/_/beardslap.gif'
        config.vendor_code = 'test'
        config.vendor_name = 'test.tool'
        config.vendor_description = 'We test things'
        config.vendor_url = 'http://www.example.com/about'
        config.vendor_contact_email = '*****@*****.**'
        config.vendor_contact_name = 'Joe Support'

        config.set_custom_param('custom2', 'customval2')

        config.set_ext_params('example.com', {'extkey1': 'extval1'})
        config.set_ext_param('example.com', 'extkey2', 'extval2')
        config.set_ext_param('example.com', 'extopt1', {
            'optkey1': 'optval1',
            'optkey2': 'optval2'
        })
        config.set_ext_param('example.com', 'extopt1', {
            'labels': {
                'en': 'Image Library',
                'es': 'Biblioteca de Imagenes'
            }
        })
        config.set_ext_param('two.example.com', 'ext1key', 'ext1val')

        config.cartridge_bundle = 'BLTI001_Bundle'

        correct = normalize_xml(CC_LTI_WITH_SUBOPTIONS_XML)
        got = normalize_xml(config.to_xml())
        self.assertEqual(got, correct)
Пример #5
0
    def test_generate_xml(self):
        '''
        Should generate the expected config xml.
        '''
        config = ToolConfig(title = "Test Config", 
                secure_launch_url = "https://www.example.com/lti", 
                custom_params = {"custom1": "customval1"})
        config.description ='Description of boringness'
        config.launch_url = 'http://www.example.com/lti'
        config.icon = 'http://wil.to/_/beardslap.gif'
        config.vendor_code = 'test'
        config.vendor_name = 'test.tool'
        config.vendor_description = 'We test things'
        config.vendor_url = 'http://www.example.com/about'
        config.vendor_contact_email = '*****@*****.**'
        config.vendor_contact_name = 'Joe Support'

        config.set_custom_param('custom2', 'customval2')

        config.set_ext_params('example.com', { 'extkey1': 'extval1' })
        config.set_ext_param('example.com', 'extkey2', 'extval2')
        config.set_ext_param('example.com', 'extopt1', 
                { 'optkey1': 'optval1', 'optkey2': 'optval2' })
        config.set_ext_param('two.example.com', 'ext1key', 'ext1val')

        config.cartridge_bundle = 'BLTI001_Bundle'

        correct = normalize_xml(CC_LTI_XML)
        got = normalize_xml(config.to_xml())
        self.assertEqual(got, correct)
Пример #6
0
 def test_read_xml_config(self):
     '''
     Should read an XML config.
     '''
     config = ToolConfig.create_from_xml(CC_LTI_XML)
     self.assertEqual(normalize_xml(config.to_xml()), normalize_xml(CC_LTI_XML))
Пример #7
0
    def test_allow_suboptions(self):

        config = ToolConfig(title = "Test Config", 
                secure_launch_url = "https://www.example.com/lti", 
                custom_params = {"custom1": "customval1"})
        config.description ='Description of boringness'
        config.launch_url = 'http://www.example.com/lti'
        config.icon = 'http://wil.to/_/beardslap.gif'
        config.vendor_code = 'test'
        config.vendor_name = 'test.tool'
        config.vendor_description = 'We test things'
        config.vendor_url = 'http://www.example.com/about'
        config.vendor_contact_email = '*****@*****.**'
        config.vendor_contact_name = 'Joe Support'

        config.set_custom_param('custom2', 'customval2')

        config.set_ext_params('example.com', { 'extkey1': 'extval1' })
        config.set_ext_param('example.com', 'extkey2', 'extval2')
        config.set_ext_param('example.com', 'extopt1', 
                { 'optkey1': 'optval1', 'optkey2': 'optval2' })
        config.set_ext_param('example.com', 'extopt1', 
                { 'labels':{
                    'en':'Image Library',
                    'es':'Biblioteca de Imagenes'
                    }
                })
        config.set_ext_param('two.example.com', 'ext1key', 'ext1val')

        config.cartridge_bundle = 'BLTI001_Bundle'

        correct = normalize_xml(CC_LTI_WITH_SUBOPTIONS_XML)
        got = normalize_xml(config.to_xml())
        self.assertEqual(got, correct)