Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/4976-aws-tests #913

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@AWS @Ignore
Feature: Check whether AWS features are operational
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection

Scenario: Example Secrets endpoint
Given url base_url.concat(secrets)
And header Authorization = auth.bearer_token
When method GET
Then status 200
* match $ == "Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4"
1 change: 1 addition & 0 deletions api-tests-karate/src/test/java/karate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function fn() {
menu: '/v1/menu',
menu_v2: '/v2/menu',
items: '/items',
secrets: '/v1/secrets',

generate_auth0_token: false,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public enum WebServiceEndPoints {
STATUS("/health"),
MENU("/v1/menu"),
MENU_V2("/v2/menu"),
ITEMS("/items");
ITEMS("/items"),
SECRETS("/v1/secrets");

private final String url;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.amido.stacks.tests.api.cloud;

import com.amido.stacks.tests.api.WebServiceEndPoints;
import net.serenitybdd.rest.SerenityRest;
import net.thucydides.core.annotations.Step;

public class AwsFeaturesStatus {

final String BASE_URL = WebServiceEndPoints.BASE_URL.getUrl();

public String expectedExampleSecrets =
"Secrets -> SECRET-VALUE-1, SECRET-VALUE-2, SECRET-VALUE-3, SECRET-VALUE-4";

@Step("Get current example secrets")
public void readExampleSecrets() {
SerenityRest.get(BASE_URL + WebServiceEndPoints.SECRETS.getUrl());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.amido.stacks.tests.api.stepdefinitions;

import static net.serenitybdd.rest.SerenityRest.restAssuredThat;
import static org.hamcrest.Matchers.equalTo;

import com.amido.stacks.tests.api.cloud.AwsFeaturesStatus;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import net.thucydides.core.annotations.Steps;

public class AwsStepDefinitions {

@Steps AwsFeaturesStatus AwsFeaturesStatus;

@When("I check the example secrets")
public void check_the_example_secrets() {
AwsFeaturesStatus.readExampleSecrets();
}

@Then("the API should return the correct examples")
public void the_API_should_return() {
restAssuredThat(
lastResponse -> lastResponse.body(equalTo(AwsFeaturesStatus.expectedExampleSecrets)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@AWS @Ignore
Feature: Check whether AWS features are operational
The `/v1/secrets` endpoint returns a few example secrets to enable us to verify the connection

Scenario: Example Secrets endpoint
Given the application is running
When I check the example secrets
Then the API should return the correct examples