예제 #1
0
 def testCanInstantiate(self):
     bag = [
         element.Check(name='check', value='value'),
         element.Button(name='button', value='caption'),
         element.Input(name='input', value='caption'),
         element.Label(label_for='button', caption='caption'),
         element.RadioButton(name='name', group='group'),
         element.RadioButtonGroup(name='name', value='value'),
         element.Password(name='name', value='geheim'),
         element.TextArea(name='name', value='\n\n\n'),
         element.Installer(manifest='test.com/installer.xml'),
         element.Line(line_type='type',
                      indent='3',
                      alignment='r',
                      direction='d'),
         element.Gadget(url='test.com/gadget.xml',
                        props={
                            'key1': 'val1',
                            'key2': 'val2'
                        }),
         element.Image(url='test.com/image.png', width=100, height=200),
         element.Attachment(caption='fake caption', data='fake data')
     ]
     types_constructed = set([type(x) for x in bag])
     types_required = set(element.ALL.values())
     missing_required = types_constructed.difference(types_required)
     self.assertEquals(missing_required, set())
     missing_constructed = types_required.difference(types_constructed)
     self.assertEquals(missing_constructed, set())
예제 #2
0
    def testSerialize(self):
        self.blip.append(element.Gadget('http://test.com', {'a': 3}))
        self.wavelet.title = 'A wavelet title'
        self.blip.append(
            element.Image(url='http://www.google.com/logos/clickortreat1.gif',
                          width=320,
                          height=118))
        self.blip.append(element.Attachment(caption='fake', data='fake data'))
        self.blip.append(element.Line(line_type='li', indent='2'))
        self.blip.append('bulleted!')
        self.blip.append(
            element.Installer(
                'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml'
            ))
        self.wavelet.proxy_for('proxy').reply().append('hi from douwe')
        inlineBlip = self.blip.insert_inline_blip(5)
        inlineBlip.append('hello again!')

        serialized = self.wavelet.serialize()
        serialized = simplejson.dumps(serialized)
        self.assertTrue(serialized.find('test.com') > 0)
예제 #3
0
 def testInstaller(self):
     installer = element.Installer('http://test.com/installer.xml')
     self.assertEquals(element.Installer.class_type, installer.type)
     self.assertEquals(installer.manifest, 'http://test.com/installer.xml')