Exemplo n.º 1
0
 def testSimple(self):
   manifest_string = '\r\n'.join([
       'Manifest-Version: 1.0',
       'Created-By: ManifestParseTest',
       '',
       'Name: com/google/appengine/api/',
       'Implementation-Vendor: Google',
       'Specification-Version: 1.0',
       '',
       'Name: com/google/something/else/',
       'This: that',
   ])
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(manifest.main_section, {
       'Manifest-Version': '1.0',
       'Created-By': 'ManifestParseTest',
   })
   self.assertEqual(
       manifest.sections, {
           'com/google/appengine/api/': {
               'Name': 'com/google/appengine/api/',
               'Implementation-Vendor': 'Google',
               'Specification-Version': '1.0',
           },
           'com/google/something/else/': {
               'Name': 'com/google/something/else/',
               'This': 'that',
           },
       })
Exemplo n.º 2
0
 def testUnicode(self):
   manifest_string = u'\r\n'.join([
       'Manifest-Version: 1.0',
       'Created-By: ManifestParseTest',
       '',
       'Name: one',
       'One: 1',
       '',
       'Name: two',
       'Two: 2',
   ])
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(manifest.main_section, {
       'Manifest-Version': '1.0',
       'Created-By': 'ManifestParseTest',
   })
   self.assertEqual(manifest.sections, {
       'one': {
           'Name': 'one',
           'One': '1',
       },
       'two': {
           'Name': 'two',
           'Two': '2',
       },
   })
Exemplo n.º 3
0
 def testManifestOnly(self):
   manifest_string = '\r\n'.join([
       'Manifest-Version: 1.0',
       'Created-By: ManifestParseTest',
       '',
   ])
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(manifest.main_section, {
       'Manifest-Version': '1.0',
       'Created-By': 'ManifestParseTest',
   })
   self.assertEqual(manifest.sections, {})
Exemplo n.º 4
0
 def testTrailingBlanks(self):
   manifest_string = '\r\n'.join([
       'Manifest-Version: 1.0',
       'Created-By: ManifestParseTest',
       '',
       'Name: com/google/appengine/api/',
       'Implementation-Vendor: Google',
       'Specification-Version: 1.0',
       '',
       'Name: com/google/something/else/',
       'This: that',
       '',
   ])
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(len(manifest.sections), 2)
Exemplo n.º 5
0
 def testContinuationLines(self):
   manifest_string = '\r\n'.join([
       'Manifest-Version: 1',
       ' .0',
       'Created-By: ManifestParseTest',
       '',
       'Name: com/google/',
       ' appengine/api/',
       'Implementation-Vendor: Go',
       ' ogle',
   ])
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(manifest.main_section, {
       'Manifest-Version': '1.0',
       'Created-By': 'ManifestParseTest',
   })
   self.assertEqual(
       manifest.sections, {
           'com/google/appengine/api/': {
               'Name': 'com/google/appengine/api/',
               'Implementation-Vendor': 'Google',
           },
       })
Exemplo n.º 6
0
 def testEmptyManifest(self):
   manifest_string = '\r\n'
   manifest = jarfile._ParseManifest(manifest_string, 'dummy.jar')
   self.assertEqual(manifest.main_section, {})
   self.assertEqual(manifest.sections, {})