def test_changes_auth_to_security_category(self):
     xml = self._get_contents('data/infoxmls/authmigration.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertEqual('security',
                      result['app']['categories'][0]['category']['id'])
 def test_parse_pre_release(self):
     xml = self._get_contents('data/infoxmls/prerelease.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     version = result['app']['release']['version']
     self.assertEqual('1.0.0-alpha.1', version)
Exemple #3
0
    def get_release_info(self, url: str, is_nightly: bool = False) -> Release:
        data = None
        with self.downloader.get_archive(
                url, self.config.download_root,
                self.config.download_max_timeout,
                self.config.download_max_redirects,
                self.config.download_max_size) as download:
            meta = self.extractor.extract_app_metadata(download.filename)
            info = parse_app_metadata(meta.info_xml, self.config.info_schema,
                                      self.config.pre_info_xslt,
                                      self.config.info_xslt)
            if meta.database_xml:
                validate_database(meta.database_xml, self.config.db_schema,
                                  self.config.pre_db_xslt)
            info_app_id = info['app']['id']
            if meta.app_id != info_app_id:
                msg = 'Archive app folder is %s but info.xml reports id %s' \
                      % (meta.app_id, info_app_id)
                raise InvalidAppDirectoryException(msg)

            release = info['app']['release']
            info['app']['release']['is_nightly'] = is_nightly
            version = release['version']
            release['changelog'] = meta.changelog
            for code, value in meta.changelog.items():
                release['changelog'][code] = parse_changelog(
                    value, version, is_nightly)

            with open(download.filename, 'rb') as f:
                data = f.read()
        return info, data
Exemple #4
0
    def get_release_info(self, url: str, is_nightly: bool = False) -> Release:
        data = None
        with self.downloader.get_archive(
            url, self.config.download_root, self.config.download_max_timeout,
            self.config.download_max_redirects, self.config.download_max_size
        ) as download:
            meta = self.extractor.extract_app_metadata(download.filename)
            info = parse_app_metadata(meta.info_xml, self.config.info_schema,
                                      self.config.pre_info_xslt,
                                      self.config.info_xslt)
            if meta.database_xml:
                validate_database(meta.database_xml, self.config.db_schema,
                                  self.config.pre_db_xslt)
            info_app_id = info['app']['id']
            if meta.app_id != info_app_id:
                msg = 'Archive app folder is %s but info.xml reports id %s' \
                      % (meta.app_id, info_app_id)
                raise InvalidAppDirectoryException(msg)

            release = info['app']['release']
            info['app']['release']['is_nightly'] = is_nightly
            version = release['version']
            release['changelog'] = meta.changelog
            for code, value in meta.changelog.items():
                release['changelog'][code] = parse_changelog(value, version,
                                                             is_nightly)

            with open(download.filename, 'rb') as f:
                data = f.read()
        return info, data
Exemple #5
0
 def test_parse_minimal(self):
     xml = self._get_contents('data/infoxmls/minimal.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     expected = {
         'app': {
             'id':
             'news',
             'summary': {
                 'en': 'An RSS/Atom feed reader'
             },
             'description': {
                 'en': 'An RSS/Atom feed reader'
             },
             'authors': [{
                 'author': {
                     'homepage': None,
                     'mail': None,
                     'name': 'Bernhard Posselt'
                 }
             }],
             'name': {
                 'en': 'News'
             },
             'discussion':
             None,
             'website':
             None,
             'issue_tracker':
             'https://github.com/nextcloud/news/issues',
             'screenshots': [],
             'categories': [{
                 'category': {
                     'id': 'multimedia'
                 }
             }],
             'release': {
                 'databases': [],
                 'licenses': [{
                     'license': {
                         'id': 'agpl'
                     }
                 }],
                 'min_int_size': 32,
                 'php_extensions': [],
                 'php_max_version': '*',
                 'php_min_version': '*',
                 'raw_php_max_version': '*',
                 'raw_php_min_version': '*',
                 'platform_max_version': '13.0.0',
                 'platform_min_version': '11.0.0',
                 'raw_platform_max_version': '12',
                 'raw_platform_min_version': '11',
                 'shell_commands': [],
                 'version': '8.8.2',
             }
         }
     }
     self.assertDictEqual(expected, result)
Exemple #6
0
 def test_changes_auth_to_security_category(self):
     xml = self._get_contents('data/infoxmls/authmigration.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertEqual('security',
                      result['app']['categories'][0]['category']['id'])
Exemple #7
0
 def test_parse_pre_release(self):
     xml = self._get_contents('data/infoxmls/prerelease.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     version = result['app']['release']['version']
     self.assertEqual('1.0.0-alpha.1', version)
Exemple #8
0
 def test_parse_non_doc_urls(self):
     xml = self._get_contents('data/infoxmls/nondocurls.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertNotIn('admin_docs', result['app'])
     self.assertNotIn('developer_docs', result['app'])
     self.assertNotIn('user_docs', result['app'])
 def test_parse_non_doc_urls(self):
     xml = self._get_contents('data/infoxmls/nondocurls.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertNotIn('admin_docs', result['app'])
     self.assertNotIn('developer_docs', result['app'])
     self.assertNotIn('user_docs', result['app'])
Exemple #10
0
 def test_parse_minimal_nextcloud(self):
     xml = self._get_contents('data/infoxmls/nextcloud.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     min_version = result['app']['release']['platform_min_version']
     max_version = result['app']['release']['platform_max_version']
     self.assertEqual('10.0.0', min_version)
     self.assertEqual('12.0.0', max_version)
 def test_release_create_nighly(self):
     result = parse_app_metadata(self.min, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     result['app']['release']['is_nightly'] = True
     result['app']['website'] = 'https://website.com'
     self.importer.import_data('app', result['app'], None)
     app = App.objects.get(pk='news')
     self.assertEqual('https://website.com', app.website)
 def test_release_create_nighly(self):
     result = parse_app_metadata(self.min, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     result['app']['release']['is_nightly'] = True
     result['app']['website'] = 'https://website.com'
     self.importer.import_data('app', result['app'], None)
     app = App.objects.get(pk='news')
     self.assertEqual('https://website.com', app.website)
Exemple #13
0
 def test_parse_minimal_nextcloud(self):
     xml = self._get_contents('data/infoxmls/nextcloud.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     min_version = result['app']['release']['platform_min_version']
     max_version = result['app']['release']['platform_max_version']
     self.assertEqual('10.0.0', min_version)
     self.assertEqual('12.0.0', max_version)
 def test_release_no_update_prerelease(self):
     result = parse_app_metadata(self.min, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.importer.import_data('app', result['app'], None)
     result['app']['website'] = 'https://website.com'
     result['app']['release']['version'] = '9.0.0-alpha'
     self.importer.import_data('app', result['app'], None)
     app = App.objects.get(pk='news')
     self.assertEqual('', app.website)
 def test_release_no_update_prerelease(self):
     result = parse_app_metadata(self.min, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.importer.import_data('app', result['app'], None)
     result['app']['website'] = 'https://website.com'
     result['app']['release']['version'] = '9.0.0-alpha'
     self.importer.import_data('app', result['app'], None)
     app = App.objects.get(pk='news')
     self.assertEqual('', app.website)
    def test_import_minimal(self):
        # check if translations are removed
        self.app.set_current_language('de')
        self.app.name = 'Should not exist'
        self.app.save()

        result = parse_app_metadata(self.min, self.config.info_schema,
                                    self.config.pre_info_xslt,
                                    self.config.info_xslt)
        self.importer.import_data('app', result['app'], None)
        app = App.objects.get(pk='news')
        self._assert_all_empty(
            app, ['user_docs', 'admin_docs', 'website', 'developer_docs'])
        # l10n
        app.set_current_language('en')
        self.assertEqual('News', app.name)
        self.assertEqual('An RSS/Atom feed reader', app.description)
        app.set_current_language('de')  # fallback
        self.assertEqual('News', app.name)

        # authors
        self.assertEqual(1, app.authors.count())
        self.assertEqual('Bernhard Posselt', app.authors.all()[0].name)

        # categories
        self.assertEqual(1, app.categories.count())
        self.assertEqual('multimedia', app.categories.all()[0].id)

        self.assertEqual('https://github.com/nextcloud/news/issues',
                         app.issue_tracker)

        self.assertEqual(0, app.screenshots.count())
        self.assertEqual(0, Screenshot.objects.count())

        release = app.releases.all()[0]
        self.assertEqual(settings.CERTIFICATE_DIGEST, release.signature_digest)
        self.assertEqual('8.8.2', release.version)
        self.assertEqual('>=11.0.0,<13.0.0', release.platform_version_spec)
        self.assertEqual('*', release.php_version_spec)
        self.assertEqual('>=11,<=12', release.raw_platform_version_spec)
        self.assertEqual('*', release.raw_php_version_spec)
        self.assertEqual(32, release.min_int_size)
        self._assert_all_empty(release, ['signature', 'download'])
        self.assertEqual(0, release.php_extensions.count())
        self.assertEqual(0, release.databases.count())
        self.assertEqual(0, release.shell_commands.count())
        self.assertEqual(0, release.shell_commands.count())
        self.assertEqual(1, release.licenses.count())
        self.assertEqual('agpl', release.licenses.all()[0].id)
    def test_import_minimal(self):
        # check if translations are removed
        self.app.set_current_language('de')
        self.app.name = 'Should not exist'
        self.app.save()

        result = parse_app_metadata(self.min, self.config.info_schema,
                                    self.config.pre_info_xslt,
                                    self.config.info_xslt)
        self.importer.import_data('app', result['app'], None)
        app = App.objects.get(pk='news')
        self._assert_all_empty(app, ['user_docs', 'admin_docs', 'website',
                                     'developer_docs'])
        # l10n
        app.set_current_language('en')
        self.assertEqual('News', app.name)
        self.assertEqual('An RSS/Atom feed reader', app.description)
        app.set_current_language('de')  # fallback
        self.assertEqual('News', app.name)

        # authors
        self.assertEqual(1, app.authors.count())
        self.assertEqual('Bernhard Posselt', app.authors.all()[0].name)

        # categories
        self.assertEqual(1, app.categories.count())
        self.assertEqual('multimedia', app.categories.all()[0].id)

        self.assertEqual('https://github.com/nextcloud/news/issues',
                         app.issue_tracker)

        self.assertEqual(0, app.screenshots.count())
        self.assertEqual(0, Screenshot.objects.count())

        release = app.releases.all()[0]
        self.assertEqual(settings.CERTIFICATE_DIGEST, release.signature_digest)
        self.assertEqual('8.8.2', release.version)
        self.assertEqual('>=11.0.0,<13.0.0', release.platform_version_spec)
        self.assertEqual('*', release.php_version_spec)
        self.assertEqual('>=11,<=12', release.raw_platform_version_spec)
        self.assertEqual('*', release.raw_php_version_spec)
        self.assertEqual(32, release.min_int_size)
        self._assert_all_empty(release, ['signature', 'download'])
        self.assertEqual(0, release.php_extensions.count())
        self.assertEqual(0, release.databases.count())
        self.assertEqual(0, release.shell_commands.count())
        self.assertEqual(0, release.shell_commands.count())
        self.assertEqual(1, release.licenses.count())
        self.assertEqual('agpl', release.licenses.all()[0].id)
Exemple #18
0
 def test_parse_minimal(self):
     xml = self._get_contents('data/infoxmls/minimal.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     expected = {'app': {
         'id': 'news',
         'summary': {'en': 'An RSS/Atom feed reader'},
         'description': {'en': 'An RSS/Atom feed reader'},
         'authors': [{'author': {
             'homepage': None,
             'mail': None,
             'name': 'Bernhard Posselt'
         }}],
         'name': {'en': 'News'},
         'discussion': None,
         'website': None,
         'issue_tracker': 'https://github.com/nextcloud/news/issues',
         'screenshots': [],
         'categories': [{'category': {'id': 'multimedia'}}],
         'release': {
             'databases': [],
             'licenses': [{'license': {'id': 'agpl'}}],
             'min_int_size': 32,
             'php_extensions': [],
             'php_max_version': '*',
             'php_min_version': '*',
             'raw_php_max_version': '*',
             'raw_php_min_version': '*',
             'platform_max_version': '13.0.0',
             'platform_min_version': '11.0.0',
             'raw_platform_max_version': '12',
             'raw_platform_min_version': '11',
             'shell_commands': [],
             'version': '8.8.2',
         }
     }}
     self.assertDictEqual(expected, result)
Exemple #19
0
 def test_parse_invalid_elements(self):
     xml = self._get_contents('data/infoxmls/invalid-elements.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #20
0
 def test_parse_collaboration(self):
     xml = self._get_contents(
         'data/infoxmls/collaboration.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #21
0
 def test_parse_repair_jobs(self):
     xml = self._get_contents('data/infoxmls/repair-and-jobs.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #22
0
 def test_validate_english_description(self):
     xml = self._get_contents('data/infoxmls/no_en_description.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #23
0
 def test_broken_xml(self):
     xml = self._get_contents('data/infoxmls/broken-xml.xml')
     with (self.assertRaises(ParseError)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #24
0
 def test_parse_sabre(self):
     xml = self._get_contents(
         'data/infoxmls/sabre.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #25
0
 def test_parse_digit_id(self):
     xml = self._get_contents('data/infoxmls/digits.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertEqual('twofactor_u2f', result['app']['id'])
Exemple #26
0
 def test_validate_english_description(self):
     xml = self._get_contents('data/infoxmls/no_en_description.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #27
0
 def test_bad_shell(self):
     xml = self._get_contents('data/infoxmls/badcommand.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #28
0
 def test_broken_xml(self):
     xml = self._get_contents('data/infoxmls/broken-xml.xml')
     with (self.assertRaises(ParseError)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #29
0
 def test_fixes_xml(self):
     xml = self._get_contents('data/infoxmls/news.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
    def test_full(self):
        Database.objects.create(id='sqlite')
        Database.objects.create(id='pgsql')
        Database.objects.create(id='mysql')
        result = parse_app_metadata(self.full, self.config.info_schema,
                                    self.config.pre_info_xslt,
                                    self.config.info_xslt)
        self.importer.import_data('app', result['app'], None)
        app = App.objects.get(pk='news')
        # l10n
        app.set_current_language('en')
        self.assertEqual('News', app.name)
        self.assertEqual('An RSS/Atom feed reader', app.summary)
        self.assertEqual('#This is markdown', app.description)
        app.set_current_language('de')  # fallback
        self.assertEqual('Nachrichten', app.name)
        self.assertEqual(
            'Eine Nachrichten App, welche mit [RSS/Atom]('
            'https://en.wikipedia.org/wiki/RSS) umgehen kann', app.description)
        release = app.releases.all()[0]
        screenshots = app.screenshots.all()
        extensions = release.php_extensions.all()
        databases = release.databases.all()

        self.assertEqual(2, screenshots.count())
        self.assertEqual('https://example.com/1-thumb.png',
                         screenshots[0].small_thumbnail)
        self.assertEqual('', screenshots[1].small_thumbnail)
        self.assertEqual(3, databases.count())
        self.assertEqual(4, extensions.count())

        for db in databases:
            if db.id == 'sqlite':
                self.assertEqual('*',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 db.releasedependencies.get().raw_version_spec)
            elif db.id == 'pgsql':
                self.assertEqual('>=9.4.0',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('>=9.4',
                                 db.releasedependencies.get().raw_version_spec)
            elif db.id == 'mysql':
                self.assertEqual('>=5.5.0',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('>=5.5',
                                 db.releasedependencies.get().raw_version_spec)
        for ex in extensions:
            if ex.id == 'libxml':
                self.assertEqual('>=2.7.8',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('>=2.7.8',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'curl':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'SimpleXML':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'iconv':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
    def test_full(self):
        Database.objects.create(id='sqlite')
        Database.objects.create(id='pgsql')
        Database.objects.create(id='mysql')
        result = parse_app_metadata(self.full, self.config.info_schema,
                                    self.config.pre_info_xslt,
                                    self.config.info_xslt)
        self.importer.import_data('app', result['app'], None)
        app = App.objects.get(pk='news')
        # l10n
        app.set_current_language('en')
        self.assertEqual('https://github.com/owncloud/news', app.website)
        self.assertEqual('https://github.com/owncloud/disc', app.discussion)
        self.assertEqual(
            'https://github.com/owncloud/news/wiki#user-documentation',
            app.user_docs)
        self.assertEqual('News', app.name)
        self.assertEqual('An RSS/Atom feed reader', app.summary)
        self.assertEqual('#This is markdown', app.description)
        app.set_current_language('de')  # fallback
        self.assertEqual('Nachrichten', app.name)
        self.assertEqual(
            'Eine Nachrichten App, welche mit [RSS/Atom]('
            'https://en.wikipedia.org/wiki/RSS) umgehen kann',
            app.description)
        release = app.releases.all()[0]
        screenshots = app.screenshots.all()
        extensions = release.php_extensions.all()
        databases = release.databases.all()

        self.assertEqual(2, screenshots.count())
        self.assertEqual('https://example.com/1-thumb.png',
                         screenshots[0].small_thumbnail)
        self.assertEqual('', screenshots[1].small_thumbnail)
        self.assertEqual(3, databases.count())
        self.assertEqual(4, extensions.count())

        for db in databases:
            if db.id == 'sqlite':
                self.assertEqual('*',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 db.releasedependencies.get().raw_version_spec)
            elif db.id == 'pgsql':
                self.assertEqual('>=9.4.0',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('>=9.4',
                                 db.releasedependencies.get().raw_version_spec)
            elif db.id == 'mysql':
                self.assertEqual('>=5.5.0',
                                 db.releasedependencies.get().version_spec)
                self.assertEqual('>=5.5',
                                 db.releasedependencies.get().raw_version_spec)
        for ex in extensions:
            if ex.id == 'libxml':
                self.assertEqual('>=2.7.8',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('>=2.7.8',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'curl':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'SimpleXML':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
            elif ex.id == 'iconv':
                self.assertEqual('*',
                                 ex.releasedependencies.get().version_spec)
                self.assertEqual('*',
                                 ex.releasedependencies.get().raw_version_spec)
Exemple #32
0
 def test_parse_settings_and_activity_and_nav(self):
     xml = self._get_contents(
         'data/infoxmls/settings-and-activity-and-nav.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #33
0
 def test_fixes_xml(self):
     xml = self._get_contents('data/infoxmls/news.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #34
0
 def test_parse_collaboration(self):
     xml = self._get_contents(
         'data/infoxmls/collaboration.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #35
0
 def test_bad_shell(self):
     xml = self._get_contents('data/infoxmls/badcommand.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #36
0
 def test_parse_sabre(self):
     xml = self._get_contents(
         'data/infoxmls/sabre.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #37
0
 def test_map_data(self):
     full = self._get_contents('data/infoxmls/full.xml')
     result = parse_app_metadata(full, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     expected = {'app': {
         'id': 'news',
         'admin_docs': 'https://github.com/owncloud/news#readme',
         'categories': [
             {'category': {'id': 'multimedia'}},
             {'category': {'id': 'tools'}}
         ],
         'authors': [
             {'author': {
                 'homepage': 'http://example.com',
                 'mail': '*****@*****.**',
                 'name': 'Bernhard Posselt'
             }},
             {'author': {
                 'homepage': None,
                 'mail': None,
                 'name': 'Alessandro Cosentino'
             }},
             {'author': {
                 'homepage': None,
                 'mail': None,
                 'name': 'Jan-Christoph Borchardt'
             }}
         ],
         'summary': {
             'en': 'An RSS/Atom feed reader',
             'de': 'An RSS/Atom feed reader',
         },
         'description': {
             'en': '#This is markdown',
             'de': 'Eine Nachrichten App, welche mit [RSS/Atom]('
                   'https://en.wikipedia.org/wiki/RSS) umgehen kann'
         },
         'developer_docs':
             'https://github.com/owncloud/news/wiki#developer'
             '-documentation',
         'user_docs': 'https://github.com/owncloud/news/wiki#user'
                      '-documentation',
         'website': 'https://github.com/owncloud/news',
         'discussion': 'https://help.nextcloud.com/t/news/1',
         'issue_tracker': 'https://github.com/owncloud/news/issues',
         'name': {'de': 'Nachrichten', 'en': 'News'},
         'release': {
             'databases': [
                 {'database': {
                     'id': 'pgsql',
                     'max_version': '*',
                     'min_version': '9.4.0',
                     'raw_max_version': '*',
                     'raw_min_version': '9.4',
                 }},
                 {'database': {
                     'id': 'sqlite',
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                 }},
                 {'database': {
                     'id': 'mysql',
                     'max_version': '*',
                     'min_version': '5.5.0',
                     'raw_max_version': '*',
                     'raw_min_version': '5.5',
                 }}
             ],
             'licenses': [
                 {'license': {'id': 'agpl'}}
             ],
             'min_int_size': 64,
             'php_extensions': [
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '2.7.8',
                     'raw_max_version': '*',
                     'raw_min_version': '2.7.8',
                     'id': 'libxml'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'curl'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'SimpleXML'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'iconv'
                 }}
             ],
             'php_max_version': '*',
             'php_min_version': '5.6.0',
             'raw_php_max_version': '*',
             'raw_php_min_version': '5.6',
             'platform_max_version': '11.0.0',
             'platform_min_version': '9.0.0',
             'raw_platform_max_version': '10',
             'raw_platform_min_version': '9',
             'shell_commands': [
                 {'shell_command': {'name': 'grep'}},
                 {'shell_command': {'name': 'ls'}}
             ],
             'version': '8.8.2',
         },
         'screenshots': [
             {'screenshot': {'url': 'https://example.com/1.png',
                             'small_thumbnail': None, 'ordering': 1}},
             {'screenshot': {'url': 'https://example.com/2.jpg',
                             'small_thumbnail': None, 'ordering': 2}}
         ],
     }}
     self.assertDictEqual(expected, result)
Exemple #38
0
 def test_parse_switched_non_doc_urls(self):
     xml = self._get_contents('data/infoxmls/switchednondocurls.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #39
0
 def test_parse_settings_and_activity_and_nav(self):
     xml = self._get_contents(
         'data/infoxmls/settings-and-activity-and-nav.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)
Exemple #40
0
 def test_parse_digit_id(self):
     xml = self._get_contents('data/infoxmls/digits.xml')
     result = parse_app_metadata(xml, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     self.assertEqual('twofactor_u2f', result['app']['id'])
Exemple #41
0
 def test_map_data(self):
     full = self._get_contents('data/infoxmls/full.xml')
     result = parse_app_metadata(full, self.config.info_schema,
                                 self.config.pre_info_xslt,
                                 self.config.info_xslt)
     expected = {'app': {
         'id': 'news',
         'admin_docs': 'https://github.com/owncloud/news#readme',
         'categories': [
             {'category': {'id': 'multimedia'}},
             {'category': {'id': 'tools'}}
         ],
         'authors': [
             {'author': {
                 'homepage': 'http://example.com',
                 'mail': '*****@*****.**',
                 'name': 'Bernhard Posselt'
             }},
             {'author': {
                 'homepage': None,
                 'mail': None,
                 'name': 'Alessandro Cosentino'
             }},
             {'author': {
                 'homepage': None,
                 'mail': None,
                 'name': 'Jan-Christoph Borchardt'
             }}
         ],
         'summary': {
             'en': 'An RSS/Atom feed reader',
             'de': 'An RSS/Atom feed reader',
         },
         'description': {
             'en': '#This is markdown',
             'de': 'Eine Nachrichten App, welche mit [RSS/Atom]('
                   'https://en.wikipedia.org/wiki/RSS) umgehen kann'
         },
         'developer_docs':
             'https://github.com/owncloud/news/wiki#developer'
             '-documentation',
         'user_docs': 'https://github.com/owncloud/news/wiki#user'
                      '-documentation',
         'website': 'https://github.com/owncloud/news',
         'discussion': 'https://help.nextcloud.com/t/news/1',
         'issue_tracker': 'https://github.com/owncloud/news/issues',
         'name': {'de': 'Nachrichten', 'en': 'News'},
         'release': {
             'databases': [
                 {'database': {
                     'id': 'pgsql',
                     'max_version': '*',
                     'min_version': '9.4.0',
                     'raw_max_version': '*',
                     'raw_min_version': '9.4',
                 }},
                 {'database': {
                     'id': 'sqlite',
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                 }},
                 {'database': {
                     'id': 'mysql',
                     'max_version': '*',
                     'min_version': '5.5.0',
                     'raw_max_version': '*',
                     'raw_min_version': '5.5',
                 }}
             ],
             'licenses': [
                 {'license': {'id': 'agpl'}}
             ],
             'min_int_size': 64,
             'php_extensions': [
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '2.7.8',
                     'raw_max_version': '*',
                     'raw_min_version': '2.7.8',
                     'id': 'libxml'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'curl'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'SimpleXML'
                 }},
                 {'php_extension': {
                     'max_version': '*',
                     'min_version': '*',
                     'raw_max_version': '*',
                     'raw_min_version': '*',
                     'id': 'iconv'
                 }}
             ],
             'php_max_version': '*',
             'php_min_version': '5.6.0',
             'raw_php_max_version': '*',
             'raw_php_min_version': '5.6',
             'platform_max_version': '11.0.0',
             'platform_min_version': '9.0.0',
             'raw_platform_max_version': '10',
             'raw_platform_min_version': '9',
             'shell_commands': [
                 {'shell_command': {'name': 'grep'}},
                 {'shell_command': {'name': 'ls'}}
             ],
             'version': '8.8.2',
         },
         'screenshots': [
             {'screenshot': {'url': 'https://example.com/1.png',
                             'small_thumbnail': None, 'ordering': 1}},
             {'screenshot': {'url': 'https://example.com/2.jpg',
                             'small_thumbnail': None, 'ordering': 2}}
         ],
     }}
     self.assertDictEqual(expected, result)
Exemple #42
0
 def test_parse_switched_non_doc_urls(self):
     xml = self._get_contents('data/infoxmls/switchednondocurls.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #43
0
 def test_parse_invalid_elements(self):
     xml = self._get_contents('data/infoxmls/invalid-elements.xml')
     with (self.assertRaises(InvalidAppMetadataXmlException)):
         parse_app_metadata(xml, self.config.info_schema,
                            self.config.pre_info_xslt,
                            self.config.info_xslt)
Exemple #44
0
 def test_parse_repair_jobs(self):
     xml = self._get_contents('data/infoxmls/repair-and-jobs.xml')
     parse_app_metadata(xml, self.config.info_schema,
                        self.config.pre_info_xslt,
                        self.config.info_xslt)