Skip to content
Snippets Groups Projects
Commit 4697260e authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/master/v0.8-test-mig' into 'master'

Update to 0.8.0 api common, migrate tests to new format

See merge request !37
parents 6ac2acbe 2918c93f
No related branches found
No related tags found
1 merge request!37Update to 0.8.0 api common, migrate tests to new format
Pipeline #30887 passed
......@@ -10,7 +10,7 @@
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.16.7.Final</quarkus.platform.version>
<eclipse-api-version>0.7.7</eclipse-api-version>
<eclipse-api-version>0.8.0</eclipse-api-version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
......
......@@ -5,6 +5,7 @@ quarkus.http.port=8080
quarkus.oidc.enabled=false
quarkus.keycloak.devservices.enabled=false
eclipse.pagination.filter.enabled=false
# Pagination configs
eclipse.pagination.filter.enabled=false
......
......@@ -13,8 +13,9 @@ package org.eclipsefoundation.geoip.client.resources;
import org.eclipsefoundation.geoip.client.test.namespaces.SchemaNamespaceHelper;
import org.eclipsefoundation.testing.helpers.TestCaseHelper;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates.EndpointTestCase;
import org.eclipsefoundation.testing.models.EndpointTestBuilder;
import org.eclipsefoundation.testing.models.EndpointTestCase;
import org.junit.jupiter.api.Test;
import io.quarkus.test.junit.QuarkusTest;
......@@ -42,20 +43,20 @@ class CityResourceTest {
@Test
void testCities_success() {
RestAssuredTemplates.testGet(IPV4_SUCCESS);
RestAssuredTemplates.testGet(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).run();
EndpointTestBuilder.from(IPV6_SUCCESS).run();
}
@Test
void testCities_success_validSchema() {
RestAssuredTemplates.testGet_validateSchema(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateSchema(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckSchema().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckSchema().run();
}
@Test
void testCities_success_validateResponseFormat() {
RestAssuredTemplates.testGet_validateResponseFormat(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateResponseFormat(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckFormat().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckFormat().run();
}
@Test
......@@ -69,17 +70,17 @@ class CityResourceTest {
// IPv4 tests
for (String ip : badIPV4s) {
testCase = TestCaseHelper.buildBadRequestCase(CITIES_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
// seems to be an issue with Google Guava code, only gets detected by MaxMind
testCase = TestCaseHelper.prepareTestCase(CITIES_ENDPOINT_URL, new String[] { "0.1.1.1" }, "")
.setStatusCode(500).build();
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
// IPv6 test
testCase = TestCaseHelper.buildBadRequestCase(CITIES_ENDPOINT_URL, new String[] { "bad:ip:add::res" }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
@Test
......@@ -91,12 +92,12 @@ class CityResourceTest {
for (String ip : badIPV4s) {
testCase = TestCaseHelper.buildBadRequestCase(CITIES_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
for (String ip : badIPV6s) {
testCase = TestCaseHelper.buildBadRequestCase(CITIES_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
}
}
......@@ -13,8 +13,9 @@ package org.eclipsefoundation.geoip.client.resources;
import org.eclipsefoundation.geoip.client.test.namespaces.SchemaNamespaceHelper;
import org.eclipsefoundation.testing.helpers.TestCaseHelper;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates.EndpointTestCase;
import org.eclipsefoundation.testing.models.EndpointTestBuilder;
import org.eclipsefoundation.testing.models.EndpointTestCase;
import org.junit.jupiter.api.Test;
import io.quarkus.test.junit.QuarkusTest;
......@@ -43,20 +44,20 @@ class CountryResourceTest {
@Test
void testCountries_success() {
RestAssuredTemplates.testGet(IPV4_SUCCESS);
RestAssuredTemplates.testGet(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).run();
EndpointTestBuilder.from(IPV6_SUCCESS).run();
}
@Test
void testCities_success_validSchema() {
RestAssuredTemplates.testGet_validateSchema(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateSchema(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckSchema().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckSchema().run();
}
@Test
void testCities_success_validateResponseFormat() {
RestAssuredTemplates.testGet_validateResponseFormat(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateResponseFormat(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckFormat().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckFormat().run();
}
@Test
......@@ -70,17 +71,17 @@ class CountryResourceTest {
// IPv4 tests
for (String ip : badIPV4s) {
testCase = TestCaseHelper.buildBadRequestCase(COUNTRY_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
// seems to be an issue with Google Guava code, only gets detected by MaxMind
testCase = TestCaseHelper.prepareTestCase(COUNTRY_ENDPOINT_URL, new String[] { "0.1.1.1" }, "")
.setStatusCode(500).build();
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
// IPv6 test
testCase = TestCaseHelper.buildBadRequestCase(COUNTRY_ENDPOINT_URL, new String[] { "bad:ip:add::res" }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
@Test
......@@ -92,12 +93,12 @@ class CountryResourceTest {
for (String ip : badIPV4s) {
testCase = TestCaseHelper.buildBadRequestCase(COUNTRY_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
for (String ip : badIPV6s) {
testCase = TestCaseHelper.buildBadRequestCase(COUNTRY_ENDPOINT_URL, new String[] { ip }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
}
}
......@@ -13,8 +13,9 @@ package org.eclipsefoundation.geoip.client.resources;
import org.eclipsefoundation.geoip.client.test.namespaces.SchemaNamespaceHelper;
import org.eclipsefoundation.testing.helpers.TestCaseHelper;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates;
import org.eclipsefoundation.testing.templates.RestAssuredTemplates.EndpointTestCase;
import org.eclipsefoundation.testing.models.EndpointTestBuilder;
import org.eclipsefoundation.testing.models.EndpointTestCase;
import org.junit.jupiter.api.Test;
import io.quarkus.test.junit.QuarkusTest;
......@@ -38,20 +39,20 @@ class SubnetResourceTest {
@Test
void testSubnets_success() {
RestAssuredTemplates.testGet(IPV4_SUCCESS);
RestAssuredTemplates.testGet(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).run();
EndpointTestBuilder.from(IPV6_SUCCESS).run();
}
@Test
void testSubnets_success_validSchema() {
RestAssuredTemplates.testGet_validateSchema(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateSchema(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckSchema().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckSchema().run();
}
@Test
void testSubnets_success_validateResponseFormat() {
RestAssuredTemplates.testGet_validateResponseFormat(IPV4_SUCCESS);
RestAssuredTemplates.testGet_validateResponseFormat(IPV6_SUCCESS);
EndpointTestBuilder.from(IPV4_SUCCESS).andCheckFormat().run();
EndpointTestBuilder.from(IPV6_SUCCESS).andCheckFormat().run();
}
@Test
......@@ -62,13 +63,13 @@ class SubnetResourceTest {
// bad ipv4 calls
for (String locale : badLocales) {
testCase = TestCaseHelper.buildNotFoundCase(SUBNETS_ENDPOINT_URL, new String[] { "ipv4", locale }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
// bad ipv6 calls
for (String locale : badLocales) {
testCase = TestCaseHelper.buildNotFoundCase(SUBNETS_ENDPOINT_URL, new String[] { "ipv6", locale }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
}
......@@ -80,7 +81,7 @@ class SubnetResourceTest {
// check other permutations (regex endpoint)
for (String subnet : badSubnets) {
testCase = TestCaseHelper.buildNotFoundCase(SUBNETS_ENDPOINT_URL, new String[] { subnet, "ca" }, "");
RestAssuredTemplates.testGet(testCase);
EndpointTestBuilder.from(testCase).run();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment