Пример #1
0
 def testTostringWithListOfLocations(self):
     info1 = ManifestInfo()
     info1._template = self.template
     info1.parseManifest(self.rdfFull1)
     manifest = info1.tostring()
     
     info2 = ManifestInfo()
     info2.parseManifest(manifest)
     
     self.failUnlessEqual(info1.locations, info2.locations, 
                          "Lists of locations don't match. Serialization failed.")
Пример #2
0
    def testNonEmtpyLocations(self):
        info = ManifestInfo()
        info._template = self.template
        info.locations = ['location.foo']
        manifest = info.tostring()

        dom = etree.fromstring(manifest)
        locations = dom.findall('.//{%s}location' % ManifestInfo.NS_SLTERMS)
        location = getattr(locations[0], 'text', '')

        self.failUnlessEqual('location.foo', location,
                             "Failure in setting location element on ManifestInfo.")
Пример #3
0
    def testUpdateManifest(self):

        info = ManifestInfo()
        info._template = self.template
        info.parseManifest(ManifestInfoTest.manifestDcFull)

        self.assertEqual('machine', info.type)
        info.type = 'disk'

        xml = info.tostring()
        info = ManifestInfo()
        info.template = self.template
        info.parseManifest(xml)

        self.assertEqual('disk', info.type)