Exemplo n.º 1
0
 def test_remove_file(self):
     manifest = Manifest(testdata)
     result = manifest.find('/')
     self.assertIsNotNone(result)
     manifest.remove('/')
     result = manifest.find('/')
     self.assertIsNone(result)
Exemplo n.º 2
0
 def test_query_file(self):
     XML = '{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}'
     manifest = Manifest(testdata)
     rootfile = manifest.find('/')
     self.assertEqual('application/vnd.oasis.opendocument.text', rootfile.get(XML+'media-type'))
     rdf = manifest.find('manifest.rdf')
     self.assertEqual('application/rdf+xml', rdf.get(XML+'media-type'))
Exemplo n.º 3
0
 def test_query_file(self):
     XML = '{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}'
     manifest = Manifest(testdata)
     rootfile = manifest.find('/')
     self.assertEqual('application/vnd.oasis.opendocument.text', rootfile.get(XML+'media-type'))
     rdf = manifest.find('manifest.rdf')
     self.assertEqual('application/rdf+xml', rdf.get(XML+'media-type'))
Exemplo n.º 4
0
 def test_new_manifest(self):
     manifest = Manifest()
     result = manifest.tobytes()
     self.assertEqual(
         result,
         b'<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"/>'
     )
Exemplo n.º 5
0
 def test_add_file(self):
     manifest = Manifest()
     manifest.add('test.xml', 'text/xml', '1.1')
     result = manifest.tobytes()
     self.assertEqual(result,
         b'<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">'\
             b'<manifest:file-entry '\
             b'manifest:full-path="test.xml" '\
             b'manifest:media-type="text/xml" '\
             b'manifest:version="1.1"/>'\
         b'</manifest:manifest>')
Exemplo n.º 6
0
 def test_add_file(self):
     manifest = Manifest()
     manifest.add('test.xml', 'text/xml', '1.1')
     result = manifest.tobytes()
     self.assertEqual(result,
         b'<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">'\
             b'<manifest:file-entry '\
             b'manifest:full-path="test.xml" '\
             b'manifest:media-type="text/xml" '\
             b'manifest:version="1.1"/>'\
         b'</manifest:manifest>')
Exemplo n.º 7
0
 def test_remove_file(self):
     manifest = Manifest(testdata)
     result = manifest.find('/')
     self.assertIsNotNone(result)
     manifest.remove('/')
     result = manifest.find('/')
     self.assertIsNone(result)
Exemplo n.º 8
0
 def test_query_file_not_found(self):
     manifest = Manifest(testdata)
     result = manifest.find('unknown.exe')
     self.assertIsNone(result)
Exemplo n.º 9
0
 def test_new_manifest(self):
     manifest = Manifest()
     result = manifest.tobytes()
     self.assertEqual(result, b'<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"/>')
Exemplo n.º 10
0
 def test_query_file_not_found(self):
     manifest = Manifest(testdata)
     result = manifest.find('unknown.exe')
     self.assertIsNone(result)