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", "https://sandbox.ob.hsbcnet.com/mock/obie/open-banking/v3.1/cbpii");
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,31 @@
# ********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: Delete Funds Confirmation Consent

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

Scenario Outline: Delete funds confirmation consent with valid ConsentId and request headers
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 Authorization = 'Bearer ' + authToken
And header x-customer-user-agent = '<x-customer-user-agent>'
When method delete
Then status 204
And match responseHeaders['x-fapi-interaction-id'] == '<x-fapi-interaction-id>'
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,33 @@
# ********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: Get 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']

@tag1
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 Authorization = 'Bearer ' + authToken
And header x-customer-user-agent = '<x-customer-user-agent>'
When method get
Then match responseStatus == 2xx
And match response == '''<expectedResponseBody>'''
And match responseHeaders['x-fapi-interaction-id'] == '<x-fapi-interaction-id>'

Examples:
|ConsentId|x-fapi-auth-date|x-fapi-customer-ip-address|x-fapi-interaction-id|x-customer-user-agent|expectedResponseBody|
|"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"|{"Data": {...}, "Links": {...}}|
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ********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: Funds Confirmation Consents

* def urlBase = karate.properties['url.base'] || karate.get('urlBase', 'http://localhost:8080')
* url urlBase
* def REQUEST_HEADERS = { 'Authorization': '#(AUTH_TOKEN)', 'x-fapi-auth-date': '#(FAPI_AUTH_DATE)', 'x-fapi-customer-ip-address': '#(FAPI_CUSTOMER_IP_ADDRESS)', 'x-fapi-interaction-id': '#(FAPI_INTERACTION_ID)', 'x-customer-user-agent': '#(CUSTOMER_USER_AGENT)' }
* configure headers = REQUEST_HEADERS
* def DEBTOR_ACCOUNT = { 'SchemeName': '#(SCHEME_NAME)', 'Identification': '#(IDENTIFICATION)', 'Name': '#(NAME)', 'SecondaryIdentification': '#(SECONDARY_IDENTIFICATION)' }
* def DATA_OBJECT = { 'ExpirationDateTime': '#(EXPIRATION_DATE_TIME)', 'DebtorAccount': DEBTOR_ACCOUNT }

Background:
* def AUTH_TOKEN = karate.properties['AUTH_TOKEN']
* def FAPI_AUTH_DATE = karate.properties['FAPI_AUTH_DATE']
* def FAPI_CUSTOMER_IP_ADDRESS = karate.properties['FAPI_CUSTOMER_IP_ADDRESS']
* def FAPI_INTERACTION_ID = karate.properties['FAPI_INTERACTION_ID']
* def CUSTOMER_USER_AGENT = karate.properties['CUSTOMER_USER_AGENT']
* def SCHEME_NAME = karate.properties['SCHEME_NAME']
* def IDENTIFICATION = karate.properties['IDENTIFICATION']
* def NAME = karate.properties['NAME']
* def SECONDARY_IDENTIFICATION = karate.properties['SECONDARY_IDENTIFICATION']
* def EXPIRATION_DATE_TIME = karate.properties['EXPIRATION_DATE_TIME']

Scenario: Create Funds Confirmation Consent and Test CRUD apis
Given path '/funds-confirmation-consents'
And request DATA_OBJECT
When method post
Then status 201

Scenario: Validate server Response
And match response.Data contains { 'ConsentId': '#string', 'CreationDateTime': '#string', 'Status': '#string', 'StatusUpdateDateTime': '#string', 'ExpirationDateTime': '#string', 'DebtorAccount': '#object' }
And match response == { 'Data': '#object', 'Links': '#object' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ********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: Funds Confirmation API Test

Background:
* def urlBase = karate.properties['url.base'] || karate.get('urlBase', 'http://localhost:8080')
* url urlBase
* def AUTH_TOKEN = karate.properties['AUTH_TOKEN']
* def headerParam = { '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', 'Authorization': '#('Bearer ' + AUTH_TOKEN)', '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: Verify funds confirmation creation
Given path '/funds-confirmations'
And request { "Data": { "ConsentId": "<consentId>", "Reference": "<reference>", "InstructedAmount": { "Amount": "<amount>", "Currency": "<currency>" } } }
And headers headerParam
When method post
Then status 201
And match response == """{ "Data": { "FundsConfirmationId": "#notnull", "ConsentId": "<consentId>", "CreationDateTime": "#notnull", "FundsAvailable": true, "Reference": "<reference>", "InstructedAmount": { "Amount": "<amount>", "Currency": "<currency>" } }, "Links": { "Self": "#notnull" } }"""

Examples:
| consentId | reference | amount | currency |
| '2537482945' | '12345' | '0.01' |'GBP' |