Skip to content

Commit

Permalink
AUT-891 Test for absence of SPType in connector metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Steinhain committed May 12, 2022
1 parent f3ac71c commit 9f64377
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/groovy/ee/ria/specificproxyservice/Flow.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class Connector {
Credential signatureCredential
Credential encryptionCredential

@Lazy fullMetadataUrl = "${protocol}://${host}:${port}${metadataUrl}"

Connector(Properties properties) {
this.host = properties."connector.host"
this.port = properties."connector.port"
Expand Down
4 changes: 2 additions & 2 deletions src/main/groovy/ee/ria/specificproxyservice/Requests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import static io.restassured.config.EncoderConfig.encoderConfig

class Requests {
@Step("GET metadata")
static String getMetadataBody(Flow flow) {
static String getMetadataBody(String metadataUrl) {
return given()
.config(config().encoderConfig(encoderConfig().defaultContentCharset("UTF-8")))
.relaxedHTTPSValidation()
.filter(new AllureRestAssured())
.when()
.get(flow.specificProxyService.fullMetadataUrl)
.get(metadataUrl)
.then()
.statusCode(200)
.extract().body().asString()
Expand Down
15 changes: 13 additions & 2 deletions src/test/groovy/ee/ria/specificproxyservice/MetadataSpec.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
package ee.ria.specificproxyservice

import org.hamcrest.Matchers


class MetadataSpec extends SpecificProxyServiceSpecification {
Flow flow = new Flow(props)

def "Metadata has valid signature"() {
def "Specific proxy service metadata has valid signature"() {
expect:
MetadataUtils.validateMetadataSignature(Requests.getMetadataBody(flow))
String metadata = Requests.getMetadataBody(flow.specificProxyService.fullMetadataUrl)
MetadataUtils.validateMetadataSignature(metadata)
}

def "Connector metadata has valid signature and does not contain SPType"() {
expect:
String metadata = Requests.getMetadataBody(flow.connector.fullMetadataUrl)
MetadataUtils.validateMetadataSignature(metadata)
metadata(Matchers.not(Matchers.containsString("SPType")))

}
}

0 comments on commit 9f64377

Please # to comment.