Skip to content
Open
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
23 changes: 23 additions & 0 deletions src/test/java/org/springframework/api_tests/ApiTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

package org.springframework.api_tests;

import com.intuit.karate.Results;
import com.intuit.karate.Runner;
// import com.intuit.karate.http.HttpServer;
// import com.intuit.karate.http.ServerConfig;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class ApiTest {

@Test
void testAll() {
String apiHostServer = System.getenv().getOrDefault("API_HOST", "http://localhost:8080");
Results results = Runner.path("classpath:org/springframework/api_tests")
.systemProperty("url.base", apiHostServer)
.parallel(1);
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ********RoostGPT********

# Test generated by RoostGPT for test karate using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# Feature file generated for /funds-confirmation-consents/{ConsentId}_delete for http method type DELETE
# RoostTestHash=5267390b19
#
#

# ********RoostGPT********
Feature: Funds Confirmation Consent API

Background:
* def urlBase = karate.properties['url.base'] || karate.get('urlBase', 'http://localhost:8080')
* url urlBase
* def auth_token = karate.properties['AUTH_TOKEN']
* def request_headers =
"""
{
"Authorization": "#(auth_token)",
"x-fapi-auth-date": "Wed, 30 Nov 2022 15:05:25 UTC",
"x-fapi-customer-ip-address": "12.201.45.125",
"x-fapi-interaction-id": "f8273b70-d5c0-4ef7-b3ba-2b3400fe1956",
"x-customer-user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
}
"""

Scenario Outline: Delete Funds Confirmation Consent
Given path '/funds-confirmation-consents/', '<ConsentId>'
And headers request_headers
When method delete
Then match status 204
And match responseHeaders contains {"x-fapi-interaction-id":"#string"}

Examples:
| ConsentId |
| '764331140'|
| '987654321'|
| '123456789'|

Scenario Outline: Verify Error Response
Given path '/funds-confirmation-consents/', '<ConsentId>'
And headers request_headers
When method delete
Then match status 400
And match response.Code == 'ERR-4231'
And match response.Id == "#string"
And match response.Message == "There is something wrong with the request parameters provided"
And match response.Errors[0].ErrorCode == 'UK.OBIE.Field.InvalidDate'

Examples:
| ConsentId |
| 'invalid' |
| ' ' |
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ********RoostGPT********

# Test generated by RoostGPT for test karate using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# Feature file generated for /funds-confirmation-consents/{ConsentId}_get for http method type GET
# RoostTestHash=c1dd90b8b5
#
#

# ********RoostGPT********
Feature: Funds Confirmation Consent API

Background:

* def urlBase = karate.properties['url.base'] || karate.get('urlBase', 'http://localhost:8080')
* url urlBase
* def authToken = karate.properties['AUTH_TOKEN']
* configure headers = { 'Authorization': '#(authToken)', 'Content-Type': 'application/json'}

Scenario Outline: Retrieve a funds confirmation consent

Given path '/funds-confirmation-consents', '<ConsentId>'
And header x-fapi-auth-date = '<x-fapi-auth-date>'
And header x-fapi-customer-ip-address = '<x-fapi-customer-ip-address>'
And header x-fapi-interaction-id = '<x-fapi-interaction-id>'
And header x-customer-user-agent = '<x-customer-user-agent>'
When method get
Then status 200
And match response ==
"""
{
Data: '#(Data)',
Links:
{
self: '#(self)'
}
}
"""
And assert response.Data.ConsentId == '<ConsentId>'

Examples:
| ConsentId | x-fapi-auth-date | x-fapi-customer-ip-address | x-fapi-interaction-id | x-customer-user-agent |
| '764331140' | 'Wed, 30 Nov 2022 15:05:25 UTC' | '12.201.45.125' | 'f8273b70-d5c0-4ef7-b3ba-2b3400fe1956' | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' |
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ********RoostGPT********

# Test generated by RoostGPT for test karate using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# Feature file generated for /funds-confirmation-consents_post for http method type POST
# RoostTestHash=db407f0790
#
#

# ********RoostGPT********
Feature: Create Funds Confirmation Consent

Background:
* def urlBase = karate.properties['url.base'] || karate.get('urlBase', 'http://localhost:8080')
* url urlBase
* def auth_token = karate.properties['AUTH_TOKEN']
* header Authorization = 'Bearer ' + auth_token

Scenario Outline: Successful creation of funds confirmation consent
Given path '/funds-confirmation-consents'
And request { "Data": { "ExpirationDateTime": "<expirationDateTime>", "DebtorAccount": { "SchemeName": "<schemeName>", "Identification": "<identification>", "Name": "<accountName>", "SecondaryIdentification": "<secondaryIdentification>" } } }
When method post
Then status 201
And match response.Data.ConsentId == "#string"
And match response.Data.Status == "AwaitingAuthorisation"

Examples:
| expirationDateTime | schemeName | identification | accountName | secondaryIdentification |
| '2023-10-05T10:53:10+00:00' | 'UK.OBIE.IBAN' | '40010600962147' | 'ABC' | 'Roll 56922' |

Scenario: Error in creating funds confirmation consent with missing required fields
Given path '/funds-confirmation-consents'
And request {}
When method post
Then status 400
And match response.Code == 'ERR-4231'
And match response.Id == '#string'
And match response.Message == 'There is something wrong with the request parameters provided'

Scenario: Error in creating funds confirmation consent with invalid auth token
Given path '/funds-confirmation-consents'
And request { "Data": { "ExpirationDateTime": "2023-10-05T10:53:10+00:00", "DebtorAccount": { "SchemeName": "UK.OBIE.IBAN", "Identification": '40010600962147', "Name": "ABC", "SecondaryIdentification": "Roll 56922" } } }
And header Authorization = 'Bearer invalid'
When method post
Then status 401
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ********RoostGPT********

# Test generated by RoostGPT for test karate using AI Type Azure Open AI and AI Model roostgpt-4-32k
#
# Feature file generated for /funds-confirmations_post for http method type POST
# RoostTestHash=d3d3a7c8c5
#
#

# ********RoostGPT********
Feature: Create Funds Confirmation

Background:
* url urlBase
* def AUTH_TOKEN = karate.properties['AUTH_TOKEN']

Scenario Outline: Testing Create Funds Confirmation API
Given path '/funds-confirmations'
And headers {
'Authorization': '#(AUTH_TOKEN)',
'x-fapi-auth-date': '<x-fapi-auth-date>',
'x-fapi-customer-ip-address': '<x-fapi-customer-ip-address>',
'x-fapi-interaction-id': '<x-fapi-interaction-id>',
'x-customer-user-agent': '<x-customer-user-agent>'
}
And request
"""
{
"Data": {
"ConsentId": "<ConsentId>",
"Reference": "<Reference>",
"InstructedAmount": {
"Amount": "<Amount>",
"Currency": "<Currency>"
}
}
}
"""
When method post
Then status 201
And match responseHeaders contains { 'x-fapi-interaction-id': '#string'}
And match response ==
"""
{
"Data": {
"FundsConfirmationId": "#string",
"ConsentId": "<ConsentId>",
"CreationDateTime": "#string",
"FundsAvailable": "#boolean",
"Reference": "<Reference>",
"InstructedAmount": {
"Amount": "<Amount>",
"Currency": "<Currency>"
}
},
"Links": {
"Self": "#string"
}
}
"""

Examples:
| x-fapi-auth-date | x-fapi-customer-ip-address | x-fapi-interaction-id | x-customer-user-agent | ConsentId | Reference | Amount | Currency |
| Wed, 30 Nov 2022 15:05:25 GMT | 12.201.45.125 | f8273b70-d5c0-4ef7-b3ba-2b3400fe1956 | Mozilla/5.0 (Macintosh, etc.) | 2537482945 | 12345 | 0.01 | GBP |