Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add schema validation for background-jobs and repair-steps and fail i…
…f standalone, shipped or default_enable elements are present
  • Loading branch information
Bernhard Posselt committed Aug 3, 2016
commit 7dc8f8f8e68bfd1cd95412103722a7e210fe790a
5 changes: 5 additions & 0 deletions nextcloudappstore/core/api/v1/release/pre-info.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
<xsl:apply-templates select="dependencies"/>
<xsl:copy-of select="background-jobs"/>
<xsl:apply-templates select="repair-steps"/>

<!-- copy invalid elements to fail if they are present -->
<xsl:copy-of select="standalone"/>
<xsl:copy-of select="default_enable"/>
<xsl:copy-of select="shipped"/>
</info>
</xsl:template>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../appmetadata/info.xsd">
<id>news</id>
<name>News</name>
<summary>An RSS/Atom feed reader</summary>
<description>An RSS/Atom feed reader</description>
<version>8.8.2</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<category>multimedia</category>
<dependencies>
<owncloud min-version="9.0"/>
</dependencies>
<standalone/>
<default_enable/>
<shipped>true</shipped>
</info>
7 changes: 7 additions & 0 deletions nextcloudappstore/core/api/v1/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ def test_parse_repair_jobs(self):
self.config.pre_info_xslt,
self.config.info_xslt)

def test_parse_invalid_elements(self):
xml = self._get_test_xml('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)

def test_parse_minimal_transform(self):
xml = self._get_test_xml('data/infoxmls/transform.xml')
result = parse_app_metadata(xml, self.config.info_schema,
Expand Down