Skip to content

Commit

Permalink
Merge pull request #50 from OpenBankingUK/REFAPP-1306-missing-tcs-par…
Browse files Browse the repository at this point in the history
…ties

Refapp-1306 - Add missing test cases for GET `/accounts/{AccountId}/parties`
  • Loading branch information
wkrop authored Jul 20, 2023
2 parents f2644e2 + 14dc5cc commit d64b4ec
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 0 deletions.
116 changes: 116 additions & 0 deletions manifests/ob_3.1_accounts_transactions_fca.json
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,29 @@
"method": "get",
"schemaCheck": true
},
{
"description": "All data returned for a given Account with ReadParty permission with additional schema checks, status and headers.",
"id": "OB-301-PAR-102902",
"refURI": "https://openbanking.atlassian.net/wiki/spaces/DZ/pages/937984104/Party+v3.1#Partyv3.1-PermissionCodes",
"detail": "Checks that the resource returns the correct data depending permission ReadParty with additional schema checks on status and headers.",
"parameters": {
"tokenRequestScope": "accounts",
"accountId": "$consentedAccountId"
},
"permissions": [
"ReadAccountsBasic",
"ReadParty"
],
"uri": "/accounts/$accountId/parties",
"uriImplementation": "conditional",
"resource": "Party",
"asserts": [
"OB3GLOAssertOn200",
"OB3GLOFAPIHeader"
],
"method": "get",
"schemaCheck": true
},
{
"description": "All data returned for ReadParty permission with additional schema checks, status and headers.",
"id": "OB-301-PAR-103000",
Expand Down Expand Up @@ -1216,6 +1239,77 @@
],
"schemaCheck": false
},
{
"description": "Fails when account is invalid for Parties.",
"id": "OB-301-PAR-103106",
"refURI": "https://openbanking.atlassian.net/wiki/spaces/DZ/pages/1000702294/Read+Write+Data+API+Specification+-+v3.1.1#Read/WriteDataAPISpecification-v3.1.1-400(BadRequest)v/s404(NotFound)",
"detail": "Checks the correct response is returned when given an invalid account for Parties.",
"parameters": {
"tokenRequestScope": "accounts",
"accountId": "foobar"
},
"permissions": [
"ReadAccountsBasic",
"ReadParty"
],
"uri": "/accounts/$accountId/parties",
"uriImplementation": "conditional",
"resource": "Party",
"method": "get",
"asserts_one_of": [
"OB3GLOAssertOn400",
"OB3GLOAssertOn403"
],
"schemaCheck": false
},
{
"description": "Fails 404 on an invalid Party resource.",
"id": "OB-301-PAR-103107",
"refURI": "",
"detail": "Validates that the party resource returns the correct status code (404 Not Found) given an invalid endpoint.",
"parameters": {
"tokenRequestScope": "accounts",
"accountId": "$consentedAccountId"
},
"permissions": [
"ReadAccountsBasic",
"ReadParty"
],
"uri": "/accounts/$accountId/parties/foobar",
"uriImplementation": "conditional",
"resource": "Party",
"asserts": [
"OB3GLOAssertOn404"
],
"method": "get",
"schemaCheck": false
},
{
"description": "The x-fapi-interaction-id is played-black for account Parties.",
"id": "OB-301-PAR-103108",
"refURI": "https://openbanking.atlassian.net/wiki/spaces/DZ/pages/1000015561/Parties+v3.1.1",
"detail": "Checks that the value in the x-fapi-interaction-id response header is played-back for account Parties.",
"parameters": {
"tokenRequestScope": "accounts",
"accountId": "$consentedAccountId",
"x-fapi-interaction-id": "93bac548-d2de-4546-b106-880a5018460d"
},
"headers": {
"x-fapi-interaction-id": "$x-fapi-interaction-id"
},
"permissions": [
"ReadAccountsBasic",
"ReadParty"
],
"uri": "/accounts/$accountId/parties",
"uriImplementation": "conditional",
"resource": "Party",
"method": "get",
"asserts": [
"OB3GLOAssertFAPIPlayBack"
],
"schemaCheck": false
},
{
"description": "All data returned for a given account with ReadProducts permission with additional schema checks, status and headers.",
"id": "OB-301-PRO-103200",
Expand Down Expand Up @@ -1584,6 +1678,28 @@
"method": "get",
"schemaCheck": true
},
{
"description": "Test",
"id": "OB-301-STO-103901",
"refURI": "https://openbanking.atlassian.net/wiki/spaces/DZ/pages/937721918/Standing+Orders+v3.1#StandingOrdersv3.1-PermissionCodes",
"detail": "Checks that all data for bulk resource with permission ReadStandingOrdersDetail to access the resource with additional schema checks on status and headers.",
"parameters": {
"tokenRequestScope": "accounts"
},
"permissions": [
"ReadAccountsBasic",
"ReadStandingOrdersDetail"
],
"uri": "/standing-orders",
"uriImplementation": "optional",
"resource": "StandingOrder",
"asserts": [
"OB3GLOAssertOn200",
"OB3GLOFAPIHeader"
],
"method": "get",
"schemaCheck": true
},
{
"description": "Fails when account is invalid for a Standing Order.",
"id": "OB-301-STO-104000",
Expand Down
4 changes: 4 additions & 0 deletions pkg/manifest/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ var accountsRegex = []PathRegex{
Regex: "^/accounts/" + subPathx + "/offers$",
Name: "Get Offers Resource",
},
{
Regex: "^/accounts/" + subPathx + "/parties$",
Name: "Get Parties Resource",
},
{
Regex: "^/accounts/" + subPathx + "/party$",
Name: "Get Party Resource",
Expand Down
50 changes: 50 additions & 0 deletions pkg/model/condition_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -386,6 +391,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -528,6 +538,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -670,6 +685,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -812,6 +832,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -954,6 +979,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -1096,6 +1126,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -1238,6 +1273,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -1380,6 +1420,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down Expand Up @@ -1522,6 +1567,11 @@ func conditionalityStaticData() []byte {
"method": "GET",
"endpoint": "/offers"
},
{
"condition": "conditional",
"method": "GET",
"endpoint": "/accounts/{AccountId}/parties"
},
{
"condition": "conditional",
"method": "GET",
Expand Down
2 changes: 2 additions & 0 deletions pkg/model/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var staticApiPermissions = []permission{
"/accounts/{AccountId}/direct-debits",
"/accounts/{AccountId}/offers",
"/accounts/{AccountId}/party",
"/accounts/{AccountId}/parties",
"/accounts/{AccountId}/product",
"/accounts/{AccountId}/scheduled-payments",
"/accounts/{AccountId}/standing-orders",
Expand Down Expand Up @@ -281,6 +282,7 @@ var staticApiPermissions = []permission{
Code: "ReadParty",
Endpoints: []string{
"/accounts/{AccountId}/party",
"/accounts/{AccountId}/parties",
},
Default: true,
RequiredOneOrMore: []Code{},
Expand Down
5 changes: 5 additions & 0 deletions pkg/schemaprops/pathmatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ var accountsRegex = []PathRegex{
Name: "Get Party Resource",
Mapping: "/accounts/{AccountId}/party",
},
{
Regex: ".*/accounts/" + subPathx + "/parties$",
Name: "Get Parties Resource",
Mapping: "/accounts/{AccountId}/parties",
},
{
Regex: ".*/accounts/" + subPathx + "/product$",
Name: "Get Product Resource",
Expand Down

0 comments on commit d64b4ec

Please sign in to comment.