Пример #1
0
 def test_create_package_base_without_full_name(self):
     with self.assertRaisesRegex(exceptions.PackageFormatError,
                                 'FullName is not specified'):
         package_base.PackageBase('test_format',
                                  'test_runtime_version',
                                  'test_source_directory',
                                  manifest={'FullName': None})
Пример #2
0
 def test_create_package_base_with_invalid_type(self):
     package_type = 'Invalid'
     with self.assertRaisesRegex(exceptions.PackageFormatError,
                                 'Invalid package Type {0}'
                                 .format(package_type)):
         package_base.PackageBase('test_format',
                                  'test_runtime_version',
                                  'test_source_directory',
                                  manifest={'FullName': 'mock_full_name',
                                            'Type': package_type})
Пример #3
0
 def test_create_package_base_with_invalid_full_name(self):
     full_names = ['.invalid_name_1', 'invalid..name..2', 'invalid name 3']
     for full_name in full_names:
         expected_error_message = 'Invalid FullName {0}'.format(full_name)
         with self.assertRaisesRegex(exceptions.PackageFormatError,
                                     expected_error_message):
             package_base.PackageBase('test_format',
                                      'test_runtime_version',
                                      'test_source_directory',
                                      manifest={'FullName': full_name})
Пример #4
0
 def setUpClass(cls):
     super(TestPackageBase, cls).setUpClass()
     package_base.PackageBase.__abstractmethods__ = set()
     cls.source_directory = tempfile.mkdtemp(dir=tempfile.tempdir)
     cls.version = semantic_version.Version.coerce('1.2.3')
     cls.mock_manifest = {
         'Name': 'mock_display_name',
         'FullName': 'mock_full_name',
         'Type': 'Application',
         'Version': '1.2.3',
         'Description': 'test_description',
         'Author': 'test_author',
         'Supplier': 'test_supplier',
         'Tags': ['tag1', 'tag2', 'tag3'],
         'Logo': None
     }
     cls.package_base = package_base.PackageBase('test_format',
                                                 'test_runtime_version',
                                                 cls.source_directory,
                                                 cls.mock_manifest)