示例#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',
           },
       })
示例#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',
       },
   })
示例#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, {})
示例#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)
示例#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',
           },
       })
示例#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, {})