Example #1
0
    def test_missing_parameters(self, client):
        """Prove that missing arguments are handled"""
        response = client.get("/v1/wfs/?SERVICE=WFS")
        content = response.content.decode()
        assert response.status_code == 400, content
        assert response["content-type"] == "text/xml; charset=utf-8", content

        assert_xml_equal(
            response.content,
            """<ows:ExceptionReport version="2.0.0"
 xmlns:ows="http://www.opengis.net/ows/1.1"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xml:lang="en-US"
 xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">

  <ows:Exception exceptionCode="MissingParameterValue" locator="request">
    <ows:ExceptionText>Missing required &#x27;request&#x27; parameter.</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>""",  # noqa: E501
        )

        xml_doc = validate_xsd(response.content, WFS_20_XSD)
        assert xml_doc.attrib["version"] == "2.0.0"
        exception = xml_doc.find("ows:Exception", NAMESPACES)
        assert exception.attrib["exceptionCode"] == "MissingParameterValue"
    def test_get(self, client, restaurant, bad_restaurant, xpath):
        """Prove that the happy flow works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=GetPropertyValue&VERSION=2.0.0&TYPENAMES=restaurant"
            f"&VALUEREFERENCE={xpath}"
        )
        content = read_response(response)
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "</wfs:ValueCollection>" in content

        # Validate against the WFS 2.0 XSD
        xml_doc = validate_xsd(content, WFS_20_XSD)
        assert xml_doc.attrib["numberMatched"] == "2"
        assert xml_doc.attrib["numberReturned"] == "2"
        timestamp = xml_doc.attrib["timeStamp"]

        assert_xml_equal(
            content,
            f"""<wfs:ValueCollection
       xmlns:app="http://example.org/gisserver"
       xmlns:gml="http://www.opengis.net/gml/3.2"
       xmlns:wfs="http://www.opengis.net/wfs/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://example.org/gisserver http://testserver/v1/wfs/?SERVICE=WFS&amp;VERSION=2.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAMES=restaurant http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
       timeStamp="{timestamp}" numberMatched="2" numberReturned="2">
  <wfs:member>
    <app:name>Café Noir</app:name>
  </wfs:member>
  <wfs:member>
    <app:name>Foo Bar</app:name>
  </wfs:member>
</wfs:ValueCollection>""",  # noqa: E501
        )
    def test_get_location(self, client, restaurant, coordinates):
        """Prove that rendering geometry values also works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=GetPropertyValue&VERSION=2.0.0&TYPENAMES=restaurant"
            "&VALUEREFERENCE=location"
        )
        content = read_response(response)
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "</wfs:ValueCollection>" in content

        # Validate against the WFS 2.0 XSD
        xml_doc = validate_xsd(content, WFS_20_XSD)
        assert xml_doc.attrib["numberMatched"] == "1"
        assert xml_doc.attrib["numberReturned"] == "1"
        timestamp = xml_doc.attrib["timeStamp"]

        assert_xml_equal(
            content,
            f"""<wfs:ValueCollection
       xmlns:app="http://example.org/gisserver"
       xmlns:gml="http://www.opengis.net/gml/3.2"
       xmlns:wfs="http://www.opengis.net/wfs/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://example.org/gisserver http://testserver/v1/wfs/?SERVICE=WFS&amp;VERSION=2.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAMES=restaurant http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
       timeStamp="{timestamp}" numberMatched="1" numberReturned="1">
  <wfs:member>
    <app:location>
      <gml:Point gml:id="restaurant.{restaurant.id}.1" srsName="urn:ogc:def:crs:EPSG::4326">
        <gml:pos srsDimension="2">{coordinates.point1_xml_wgs84}</gml:pos>
      </gml:Point>
    </app:location>
  </wfs:member>
</wfs:ValueCollection>""",  # noqa: E501
        )
Example #4
0
    def test_get(self, client):
        """Prove that the happy flow works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=DescribeStoredQueries&VERSION=2.0.0")
        content = response.content.decode()
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "DescribeStoredQueriesResponse" in content

        # Validate against the WFS 2.0 XSD
        xml_doc = validate_xsd(content, WFS_20_XSD)
        assert len(xml_doc) == 1

        assert_xml_equal(
            content,
            """<wfs:DescribeStoredQueriesResponse
    xmlns="http://www.opengis.net/wfs/2.0"
    xmlns:app="http://example.org/gisserver"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
  <StoredQueryDescription id="urn:ogc:def:query:OGC-WFS::GetFeatureById">
    <Title>Get feature by identifier</Title>
    <Abstract>Returns the single feature that corresponds with the ID argument</Abstract>
    <Parameter name="ID" type="xs:string"/>
    <QueryExpressionText isPrivate="true" language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression" returnFeatureTypes="restaurant mini-restaurant denied-feature"/>
  </StoredQueryDescription>
</wfs:DescribeStoredQueriesResponse>""",  # noqa: E501
        )
Example #5
0
    def test_get(self, client):
        """Prove that the happy flow works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=ListStoredQueries&VERSION=2.0.0")
        content = response.content.decode()
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "ListStoredQueriesResponse" in content

        # Validate against the WFS 2.0 XSD
        xml_doc = validate_xsd(content, WFS_20_XSD)
        assert len(xml_doc) == 1

        assert_xml_equal(
            content,
            """<wfs:ListStoredQueriesResponse
    xmlns="http://www.opengis.net/wfs/2.0"
    xmlns:app="http://example.org/gisserver"
    xmlns:wfs="http://www.opengis.net/wfs/2.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
  <StoredQuery id="urn:ogc:def:query:OGC-WFS::GetFeatureById">
    <Title>Get feature by identifier</Title>
    <ReturnFeatureType>restaurant</ReturnFeatureType>
    <ReturnFeatureType>mini-restaurant</ReturnFeatureType>
    <ReturnFeatureType>denied-feature</ReturnFeatureType>
  </StoredQuery>
</wfs:ListStoredQueriesResponse>""",  # noqa: E501
        )
    def test_describe_complex(self, client):
        """Prove that complex types are properly rendered"""
        response = client.get(
            "/v1/wfs-complextypes/?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0"
            "&TYPENAMES=restaurant")
        content = response.content.decode()
        assert response[
            "content-type"] == "application/gml+xml; version=3.2", content
        assert response.status_code == 200, content
        assert "PropertyType" in content  # for element holding a GML field

        # The response is an XSD itself.
        # Only validate it's XML structure
        xml_doc: etree._Element = etree.fromstring(response.content)
        assert xml_doc.tag == "{http://www.w3.org/2001/XMLSchema}schema"

        assert_xml_equal(
            response.content,
            """<schema
   xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:app="http://example.org/gisserver"
   xmlns:gml="http://www.opengis.net/gml/3.2"
   targetNamespace="http://example.org/gisserver"
   elementFormDefault="qualified" version="0.1">

  <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd" />

  <element name="restaurant" type="app:RestaurantType" substitutionGroup="gml:AbstractFeature" />

  <complexType name="RestaurantType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="integer" minOccurs="0" />
          <element name="name" type="string" minOccurs="0" />
          <element name="city" type="app:CityType" minOccurs="0" nillable="true" />
          <element name="location" type="gml:PointPropertyType" minOccurs="0" maxOccurs="1" nillable="true" />
          <element name="rating" type="double" minOccurs="0" />
          <element name="is_open" type="boolean" minOccurs="0" />
          <element name="created" type="dateTime" minOccurs="0" />
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="CityType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="integer" minOccurs="0" />
          <element name="name" type="string" minOccurs="0" />
        </sequence>
      </extension>
    </complexContent>
  </complexType>

</schema>""",  # noqa: E501
        )
Example #7
0
 def test_sra_dump_submission_xml_biis7(self):
     sra_settings = self._sra_default_config
     json2sra.convert2(open(os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')), self._tmp_dir, sra_settings=sra_settings, validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     submission_xml = open(os.path.join(self._tmp_dir, 'submission.xml'), 'rb').read()
     actual_submission_xml_biis7 = etree.fromstring(submission_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_submission_xml_biis7, actual_submission_xml_biis7))
Example #8
0
 def test_sra_export_run_set_xml(self):
     sra.export(self._inv_obj,
                self._tmp_dir,
                sra_settings=self._sra_default_config)
     with open(os.path.join(self._tmp_dir, 'run_set.xml'), 'rb') as out_fp:
         actual_run_set_xml_obj = etree.fromstring(out_fp.read())
         self.assertTrue(
             utils.assert_xml_equal(self._expected_run_set_xml_obj,
                                    actual_run_set_xml_obj))
Example #9
0
 def test_sra_export_submission_xml(self):
     sra.export(self._inv_obj,
                self._tmp_dir,
                sra_settings=self._sra_default_config)
     actual_submission_xml_obj = etree.fromstring(
         open(os.path.join(self._tmp_dir, 'submission.xml'), 'rb').read())
     self.assertTrue(
         utils.assert_xml_equal(self._expected_submission_xml_obj,
                                actual_submission_xml_obj))
Example #10
0
 def test_isatab2sra_dump_run_set_xml_biis7(self):
     isatab2sra.convert(self._biis7_dir,
                        self._tmp_dir,
                        validate_first=False)
     with open(os.path.join(self._tmp_dir, 'run_set.xml'), 'rb') as rs_fp:
         run_set_xml = rs_fp.read()
         actual_run_set_xml_biis7 = etree.fromstring(run_set_xml)
         self.assertTrue(
             utils.assert_xml_equal(self._expected_run_set_xml_biis7,
                                    actual_run_set_xml_biis7))
 def test_isatab2sra_dump_sample_set_xml_biis3(self):
     isatab2sra.convert(self._biis3_dir,
                        self._tmp_dir,
                        validate_first=False)
     sample_set_xml = open(os.path.join(self._tmp_dir, 'sample_set.xml'),
                           'rb').read()
     actual_sample_set_xml_biis3 = etree.fromstring(sample_set_xml)
     self.assertTrue(
         utils.assert_xml_equal(self._expected_sample_set_xml_biis3,
                                actual_sample_set_xml_biis3))
 def test_isatab2sra_dump_experiment_set_xml_biis7(self):
     isatab2sra.convert(self._biis7_dir,
                        self._tmp_dir,
                        validate_first=False)
     experiment_set_xml = open(
         os.path.join(self._tmp_dir, 'experiment_set.xml'), 'rb').read()
     actual_experiment_set_xml_biis7 = etree.fromstring(experiment_set_xml)
     self.assertTrue(
         utils.assert_xml_equal(self._expected_experiment_set_xml_biis7,
                                actual_experiment_set_xml_biis7))
Example #13
0
 def test_isatab2sra_dump_submission_xml_biis3(self):
     isatab2sra.convert(self._biis3_dir,
                        self._tmp_dir,
                        validate_first=False)
     with open(os.path.join(self._tmp_dir, 'submission.xml'),
               'rb') as sub_fp:
         submission_xml = sub_fp.read()
         actual_submission_xml_biis3 = etree.fromstring(submission_xml)
         self.assertTrue(
             utils.assert_xml_equal(self._expected_submission_xml_biis3,
                                    actual_submission_xml_biis3))
Example #14
0
 def test_isatab2sra_dump_project_set_xml_biis3(self):
     isatab2sra.convert(self._biis3_dir,
                        self._tmp_dir,
                        validate_first=False)
     with open(os.path.join(self._tmp_dir, 'project_set.xml'),
               'rb') as ps_fp:
         project_set_xml = ps_fp.read()
         actual_project_set_xml_biis3 = etree.fromstring(project_set_xml)
         self.assertTrue(
             utils.assert_xml_equal(self._expected_project_set_xml_biis3,
                                    actual_project_set_xml_biis3))
Example #15
0
 def test_sra_dump_run_set_xml_biis3(self):
     with open(os.path.join(self._json_data_dir, 'BII-S-3',
                            'BII-S-3.json')) as json_fp:
         json2sra.convert(json_fp, self._tmp_dir, validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     with open(os.path.join(self._tmp_dir, 'run_set.xml'), 'rb') as rs_fp:
         run_set_xml = rs_fp.read()
         actual_run_set_xml_biis3 = etree.fromstring(run_set_xml)
         self.assertTrue(
             utils.assert_xml_equal(self._expected_run_set_xml_biis3,
                                    actual_run_set_xml_biis3))
    def test_get_feature_by_id_stored_query(self, client, restaurant, bad_restaurant):
        """Prove that fetching objects by ID works."""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=GetPropertyValue&VERSION=2.0.0"
            f"&STOREDQUERY_ID=urn:ogc:def:query:OGC-WFS::GetFeatureById"
            f"&ID=restaurant.{restaurant.id}&VALUEREFERENCE=name"
        )
        content = read_response(response)
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "</app:restaurant>" not in content
        assert "</wfs:FeatureCollection>" not in content

        # See whether our feature is rendered
        # For GetFeatureById, no <wfs:FeatureCollection> is returned.
        assert_xml_equal(
            content,
            """<app:name xmlns:app="http://example.org/gisserver"
                         xmlns:gml="http://www.opengis.net/gml/3.2">Café Noir</app:name>""",
        )
Example #17
0
 def test_sra_dump_run_set_xml_biis7(self):
     json2sra.convert(open(
         os.path.join(self._json_data_dir, 'BII-S-7', 'BII-S-7.json')),
                      self._tmp_dir,
                      validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     run_set_xml = open(os.path.join(self._tmp_dir, 'run_set.xml'),
                        'rb').read()
     actual_run_set_xml_biis7 = etree.fromstring(run_set_xml)
     self.assertTrue(
         utils.assert_xml_equal(self._expected_run_set_xml_biis7,
                                actual_run_set_xml_biis7))
Example #18
0
 def test_isatab2sra_dump_submission_xml_biis7(self):
     sra_settings = {
         "sra_broker": "",
         "sra_center": "OXFORD",
         "sra_project": "OXFORD",
         "sra_lab": "Oxford e-Research Centre",
         "sra_broker_inform_on_status": "*****@*****.**",
         "sra_broker_inform_on_error": "*****@*****.**",
         "sra_broker_contact_name": "PRS"
     }
     isatab2sra.convert(self._biis3_dir, self._tmp_dir, sra_settings=sra_settings, validate_first=False)
     submission_xml = open(os.path.join(self._tmp_dir, 'submission.xml'), 'rb').read()
     actual_submission_xml_biis7 = etree.fromstring(submission_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_submission_xml_biis7, actual_submission_xml_biis7))
Example #19
0
 def test_isatab2sra_dump_submission_xml_biis7(self):
     sra_settings = {
         "sra_broker": "",
         "sra_center": "OXFORD",
         "sra_project": "OXFORD",
         "sra_lab": "Oxford e-Research Centre",
         "sra_broker_inform_on_status": "*****@*****.**",
         "sra_broker_inform_on_error": "*****@*****.**",
         "sra_broker_contact_name": "PRS"
     }
     isatab2sra.convert(self._biis3_dir, self._tmp_dir, sra_settings=sra_settings, validate_first=False)
     submission_xml = open(os.path.join(self._tmp_dir, 'submission.xml'), 'rb').read()
     actual_submission_xml_biis7 = etree.fromstring(submission_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_submission_xml_biis7, actual_submission_xml_biis7))
Example #20
0
 def test_sra_dump_sample_set_xml_biis7(self):
     sra_settings = self._sra_default_config
     with open(os.path.join(self._json_data_dir, 'BII-S-7',
                            'BII-S-7.json')) as json_fp:
         json2sra.convert(json_fp,
                          self._tmp_dir,
                          sra_settings=sra_settings,
                          validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     with open(os.path.join(self._tmp_dir, 'sample_set.xml'),
               'rb') as ss_fp:
         sample_set_xml = ss_fp.read()
         actual_sample_set_xml_biis7 = etree.fromstring(sample_set_xml)
         self.assertTrue(
             utils.assert_xml_equal(self._expected_sample_set_xml_biis7,
                                    actual_sample_set_xml_biis7))
Example #21
0
 def test_sra_export_project_set_xml(self):
     sra.export(self._inv_obj, self._tmp_dir, sra_settings=self._sra_default_config)
     actual_project_set_xml_obj = etree.fromstring(open(os.path.join(self._tmp_dir, 'project_set.xml'), 'rb').read())
     self.assertTrue(utils.assert_xml_equal(self._expected_project_set_xml_obj, actual_project_set_xml_obj))
Example #22
0
    def test_describe(self, client):
        """Prove that the happy flow works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0&TYPENAMES=restaurant"
        )
        content = response.content.decode()
        assert response[
            "content-type"] == "application/gml+xml; version=3.2", content
        assert response.status_code == 200, content
        assert "PropertyType" in content  # for element holding a GML field

        # The response is an XSD itself.
        # Only validate it's XML structure
        xml_doc: etree._Element = etree.fromstring(response.content)
        assert xml_doc.tag == "{http://www.w3.org/2001/XMLSchema}schema"
        elements = xml_doc.findall(
            "xsd:complexType/xsd:complexContent/xsd:extension/xsd:sequence/xsd:element",
            namespaces=NAMESPACES,
        )
        field_names = [el.attrib["name"] for el in elements]
        assert field_names == [
            "id",
            "name",
            "city_id",
            "location",
            "rating",
            "is_open",
            "created",
            "tags",
        ]

        assert_xml_equal(
            response.content,
            """<schema
   targetNamespace="http://example.org/gisserver"
   xmlns:app="http://example.org/gisserver"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:gml="http://www.opengis.net/gml/3.2"
   elementFormDefault="qualified" version="0.1">

  <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd" />

  <element name="restaurant" type="app:RestaurantType" substitutionGroup="gml:AbstractFeature" />

  <complexType name="RestaurantType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="id" type="integer" minOccurs="0" />
          <element name="name" type="string" minOccurs="0" />
          <element name="city_id" type="integer" nillable="true" minOccurs="0" />
          <element name="location" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
          <element name="rating" type="double" minOccurs="0" />
          <element name="is_open" type="boolean" minOccurs="0" />
          <element name="created" type="dateTime" minOccurs="0" />
          <element name="tags" type="string" minOccurs="0" maxOccurs="unbounded" nillable="true" />
        </sequence>
      </extension>
    </complexContent>
  </complexType>

</schema>""",  # noqa: E501
        )
Example #23
0
    def test_get(self, client, restaurant):
        """Prove that the happy flow works"""
        response = client.get(
            "/v1/wfs/?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=2.0.0"
        )
        content = response.content.decode()
        assert response["content-type"] == "text/xml; charset=utf-8", content
        assert response.status_code == 200, content
        assert "<ows:OperationsMetadata>" in content

        # Validate against the WFS 2.0 XSD
        xml_doc = validate_xsd(response.content, WFS_20_XSD)
        assert xml_doc.attrib["version"] == "2.0.0"

        # Check exposed allowed vesions
        allowed_values = xml_doc.xpath(
            "ows:OperationsMetadata/ows:Operation[@name='GetCapabilities']"
            "/ows:Parameter[@name='AcceptVersions']/ows:AllowedValues",
            namespaces=NAMESPACES,
        )[0]
        versions = [el.text for el in allowed_values.findall("ows:Value", NAMESPACES)]
        assert versions == ["2.0.0"]

        # Check exposed FeatureTypeList
        feature_type_list = xml_doc.find("wfs:FeatureTypeList", NAMESPACES)

        # The box should be within WGS84 limits, otherwise gis tools can't process the service.
        wgs84_bbox = feature_type_list.find(
            "wfs:FeatureType/ows:WGS84BoundingBox", NAMESPACES
        )
        lower = wgs84_bbox.find("ows:LowerCorner", NAMESPACES).text.split(" ")
        upper = wgs84_bbox.find("ows:UpperCorner", NAMESPACES).text.split(" ")
        coords = list(map(float, lower + upper))
        assert coords[0] >= -180
        assert coords[1] >= -90
        assert coords[2] <= 180
        assert coords[2] <= 90

        assert_xml_equal(
            etree.tostring(feature_type_list, inclusive_ns_prefixes=True).decode(),
            f"""<FeatureTypeList xmlns="{WFS_NS}" xmlns:ows="{OWS_NS}" xmlns:xlink="{XLINK_NS}">
      <FeatureType>
        <Name>app:restaurant</Name>
        <Title>restaurant</Title>
        <ows:Keywords>
          <ows:Keyword>unittest</ows:Keyword>
        </ows:Keywords>
        <DefaultCRS>urn:ogc:def:crs:EPSG::4326</DefaultCRS>
        <OtherCRS>urn:ogc:def:crs:EPSG::28992</OtherCRS>
        <OutputFormats>
          <Format>application/gml+xml; version=3.2</Format>
          <Format>text/xml; subtype=gml/3.2.1</Format>
          <Format>application/json; subtype=geojson; charset=utf-8</Format>
          <Format>text/csv; subtype=csv; charset=utf-8</Format>
        </OutputFormats>
        <ows:WGS84BoundingBox dimensions="2">
          <ows:LowerCorner>4.90876101285122 52.3631712637357</ows:LowerCorner>
          <ows:UpperCorner>4.90876101285122 52.3631712637357</ows:UpperCorner>
        </ows:WGS84BoundingBox>
        <MetadataURL xlink:href="http://testserver/v1/wfs/" />
      </FeatureType>
      <FeatureType>
        <Name>app:mini-restaurant</Name>
        <Title>restaurant</Title>
        <ows:Keywords>
          <ows:Keyword>unittest</ows:Keyword>
          <ows:Keyword>limited-fields</ows:Keyword>
        </ows:Keywords>
        <DefaultCRS>urn:ogc:def:crs:EPSG::4326</DefaultCRS>
        <OtherCRS>urn:ogc:def:crs:EPSG::28992</OtherCRS>
        <OutputFormats>
          <Format>application/gml+xml; version=3.2</Format>
          <Format>text/xml; subtype=gml/3.2.1</Format>
          <Format>application/json; subtype=geojson; charset=utf-8</Format>
          <Format>text/csv; subtype=csv; charset=utf-8</Format>
        </OutputFormats>
        <ows:WGS84BoundingBox dimensions="2">
          <ows:LowerCorner>4.90876101285122 52.3631712637357</ows:LowerCorner>
          <ows:UpperCorner>4.90876101285122 52.3631712637357</ows:UpperCorner>
        </ows:WGS84BoundingBox>
        <MetadataURL xlink:href="http://testserver/v1/wfs/" />
      </FeatureType>
      <FeatureType>
        <Name>app:denied-feature</Name>
        <Title>restaurant</Title>
        <DefaultCRS>urn:ogc:def:crs:EPSG::4326</DefaultCRS>
        <OutputFormats>
          <Format>application/gml+xml; version=3.2</Format>
          <Format>text/xml; subtype=gml/3.2.1</Format>
          <Format>application/json; subtype=geojson; charset=utf-8</Format>
          <Format>text/csv; subtype=csv; charset=utf-8</Format>
        </OutputFormats>
      </FeatureType>
    </FeatureTypeList>""",
        )
Example #24
0
 def test_sra_dump_study_xml_biis3(self):
     json2sra.convert2(open(os.path.join(self._json_data_dir, 'BII-S-3', 'BII-S-3.json')), self._tmp_dir, validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     project_set_xml = open(os.path.join(self._tmp_dir, 'project_set.xml'), 'rb').read()
     actual_project_set_xml_biis3 = etree.fromstring(project_set_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_project_set_xml_biis3, actual_project_set_xml_biis3))
Example #25
0
 def test_sra_dump_run_set_xml_biis3(self):
     json2sra.convert2(open(os.path.join(self._json_data_dir, 'BII-S-3', 'BII-S-3.json')), self._tmp_dir, validate_first=False)
     # Now try load the SRA output in test and compare against the expected output in test data directory
     run_set_xml = open(os.path.join(self._tmp_dir, 'run_set.xml'), 'rb').read()
     actual_run_set_xml_biis3 = etree.fromstring(run_set_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_run_set_xml_biis3, actual_run_set_xml_biis3))
Example #26
0
 def test_isatab2sra_dump_project_set_xml_biis7(self):
     isatab2sra.convert(self._biis7_dir, self._tmp_dir, validate_first=False)
     project_set_xml = open(os.path.join(self._tmp_dir, 'project_set.xml'), 'rb').read()
     actual_project_set_xml_biis7 = etree.fromstring(project_set_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_project_set_xml_biis7, actual_project_set_xml_biis7))
Example #27
0
 def test_isatab2sra_dump_run_set_xml_biis3(self):
     isatab2sra.convert(self._biis3_dir, self._tmp_dir, validate_first=False)
     run_set_xml = open(os.path.join(self._tmp_dir, 'run_set.xml'), 'rb').read()
     actual_run_set_xml_biis3 = etree.fromstring(run_set_xml)
     self.assertTrue(utils.assert_xml_equal(self._expected_run_set_xml_biis3, actual_run_set_xml_biis3))
 def test_assert_xml_equal(self):
     self.assertTrue(utils.assert_xml_equal(etree.fromstring(self.x1), etree.fromstring(self.x2)))