From 9f643772ed74281b6d6d9b5fc151666d518172bd Mon Sep 17 00:00:00 2001 From: Markus Kivisalu Date: Thu, 12 May 2022 17:30:41 +0300 Subject: [PATCH] AUT-891 Test for absence of SPType in connector metadata --- .../ee/ria/specificproxyservice/Flow.groovy | 2 ++ .../ee/ria/specificproxyservice/Requests.groovy | 4 ++-- .../ria/specificproxyservice/MetadataSpec.groovy | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/ee/ria/specificproxyservice/Flow.groovy b/src/main/groovy/ee/ria/specificproxyservice/Flow.groovy index 138184a..90e0bf2 100644 --- a/src/main/groovy/ee/ria/specificproxyservice/Flow.groovy +++ b/src/main/groovy/ee/ria/specificproxyservice/Flow.groovy @@ -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" diff --git a/src/main/groovy/ee/ria/specificproxyservice/Requests.groovy b/src/main/groovy/ee/ria/specificproxyservice/Requests.groovy index 05a3924..a02ba68 100644 --- a/src/main/groovy/ee/ria/specificproxyservice/Requests.groovy +++ b/src/main/groovy/ee/ria/specificproxyservice/Requests.groovy @@ -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() diff --git a/src/test/groovy/ee/ria/specificproxyservice/MetadataSpec.groovy b/src/test/groovy/ee/ria/specificproxyservice/MetadataSpec.groovy index 37a4fe5..5ad4895 100644 --- a/src/test/groovy/ee/ria/specificproxyservice/MetadataSpec.groovy +++ b/src/test/groovy/ee/ria/specificproxyservice/MetadataSpec.groovy @@ -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"))) + } } \ No newline at end of file