Skip to content

Commit

Permalink
add tests for pycsw
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Nov 10, 2023
1 parent 9c7af04 commit d0f99cf
Show file tree
Hide file tree
Showing 51 changed files with 2,548 additions and 1 deletion.
38 changes: 38 additions & 0 deletions bruno/catalogue/CSW/pycsw/DescribeRecord-json.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta {
name: DescribeRecord-json
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1"?>
<DescribeRecord service="CSW" version="2.0.2" outputFormat="application/json" schemaLanguage="http://www.w3.org/XML/Schema" xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<TypeName>csw:Record</TypeName>
</DescribeRecord>

}

assert {
res.status: eq 200
}

tests {
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("not an exception", function(){
isNotAnException(res);
})
}
38 changes: 38 additions & 0 deletions bruno/catalogue/CSW/pycsw/DescribeRecord.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta {
name: DescribeRecord
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1"?>
<DescribeRecord service="CSW" version="2.0.2" outputFormat="application/xml" schemaLanguage="http://www.w3.org/XML/Schema" xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<TypeName>csw:Record</TypeName>
</DescribeRecord>

}

assert {
res.status: eq 200
}

tests {
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("not an exception", function(){
isNotAnException(res);
})
}
59 changes: 59 additions & 0 deletions bruno/catalogue/CSW/pycsw/Exception-GetRecords-badsrsname.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
meta {
name: Exception-GetRecords-badsrsname
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" service="CSW" version="2.0.2" resultType="results" startPosition="1" maxRecords="5" outputFormat="application/xml" outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd" xmlns:gml="http://www.opengis.net/gml">
<csw:Query typeNames="csw:Record">
<csw:ElementSetName>brief</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<ogc:Filter>

<ogc:BBOX>
<ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
<gml:Envelope srsName="EPSG:226">
<gml:lowerCorner>-90 -180</gml:lowerCorner>
<gml:upperCorner>90 180</gml:upperCorner>
</gml:Envelope>
</ogc:BBOX>
</ogc:Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>


}

assert {
res.status: eq 200
}

tests {
const { XMLParser, XMLBuilder } = require("fast-xml-parser");
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("transactions are not supported", function(){
const parser = new XMLParser({ removeNSPrefix: true });
let jObj = parser.parse(res.getBody());

expect(jObj).to.have.property('ExceptionReport')
expect(jObj).to.have.nested.property('ExceptionReport.Exception.ExceptionText')
expect(jObj.ExceptionReport.Exception.ExceptionText).to.have.string('Invalid Constraint: Invalid Filter request: Reprojection error: Invalid srsName')
})
}
46 changes: 46 additions & 0 deletions bruno/catalogue/CSW/pycsw/Exception-GetRecords-elementname.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
meta {
name: Exception-GetRecords-elementname
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<csw:GetRecords xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" service="CSW" version="2.0.2" resultType="results" startPosition="1" maxRecords="5" outputFormat="application/xml" outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<csw:Query typeNames="csw:Record">
<csw:ElementName>dc:foo</csw:ElementName>
</csw:Query>
</csw:GetRecords>

}

assert {
res.status: eq 200
}

tests {
const { XMLParser, XMLBuilder } = require("fast-xml-parser");
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("transactions are not supported", function(){
const parser = new XMLParser({ removeNSPrefix: true });
let jObj = parser.parse(res.getBody());

expect(jObj).to.have.property('ExceptionReport')
expect(jObj).to.have.nested.property('ExceptionReport.Exception.ExceptionText')
expect(jObj.ExceptionReport.Exception.ExceptionText).to.have.string('Invalid ElementName parameter value')
})
}
46 changes: 46 additions & 0 deletions bruno/catalogue/CSW/pycsw/Exception-GetRecords-invalid-xml.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
meta {
name: Exception-GetRecords-invalid-xml
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<csw:GetRecords xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" service="CSW" version="2.0.2" resultType="results" startPosition="1" maxRecords="5" outputFormat="application/xml" outputSchema="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
<csw:Query typeNames="csw:Record">
<csw:ElementNamefoo>dc:foo</csw:ElementNamefoo>
</csw:Query>
</csw:GetRecords>

}

assert {
res.status: eq 200
}

tests {
const { XMLParser, XMLBuilder } = require("fast-xml-parser");
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("transactions are not supported", function(){
const parser = new XMLParser({ removeNSPrefix: true });
let jObj = parser.parse(res.getBody());

expect(jObj).to.have.property('ExceptionReport')
expect(jObj).to.have.nested.property('ExceptionReport.Exception.ExceptionText')
expect(jObj.ExceptionReport.Exception.ExceptionText).to.have.string('Exception: the document is not valid.')
})
}
47 changes: 47 additions & 0 deletions bruno/catalogue/CSW/pycsw/GetCapabilities-SOAP.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
meta {
name: GetCapabilities-SOAP
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<GetCapabilities xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd" service="CSW">
<ows:AcceptVersions>
<ows:Version>2.0.2</ows:Version>
</ows:AcceptVersions>
<ows:AcceptFormats>
<ows:OutputFormat>application/xml</ows:OutputFormat>
</ows:AcceptFormats>
</GetCapabilities>
</soapenv:Body>
</soapenv:Envelope>

}

assert {
res.status: eq 200
}

tests {
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("not an exception", function(){
isNotAnException(res);
})
}
46 changes: 46 additions & 0 deletions bruno/catalogue/CSW/pycsw/GetCapabilities-sections.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
meta {
name: GetCapabilities-sections
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1"?>
<GetCapabilities xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd" service="CSW">
<ows:AcceptVersions>
<ows:Version>2.0.2</ows:Version>
</ows:AcceptVersions>
<ows:Sections>
<ows:Section>ServiceProvider</ows:Section>
</ows:Sections>
<ows:AcceptFormats>
<ows:OutputFormat>application/xml</ows:OutputFormat>
</ows:AcceptFormats>
</GetCapabilities>

}

assert {
res.status: eq 200
}

tests {
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("not an exception", function(){
isNotAnException(res);
})
}
43 changes: 43 additions & 0 deletions bruno/catalogue/CSW/pycsw/GetCapabilities-updatesequence.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: GetCapabilities-updatesequence
type: http
seq: 3
}

post {
url: {{BASE_URL}}/csw/
body: xml
auth: none
}

body:xml {
<?xml version="1.0" encoding="ISO-8859-1"?>
<GetCapabilities updateSequence="123" xmlns="http://www.opengis.net/cat/csw/2.0.2" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd" service="CSW">
<ows:AcceptVersions>
<ows:Version>2.0.2</ows:Version>
</ows:AcceptVersions>
<ows:AcceptFormats>
<ows:OutputFormat>application/xml</ows:OutputFormat>
</ows:AcceptFormats>
</GetCapabilities>

}

assert {
res.status: eq 200
}

tests {
const {
isValidXML,
isNotAnException,
} = require('./asserts');

test("response valid", function() {
isValidXML(res);
})

test("not an exception", function(){
isNotAnException(res);
})
}
Loading

0 comments on commit d0f99cf

Please sign in to comment.