Skip to content

Commit 4be03fb

Browse files
authored
Merge pull request #357 from NHSDigital/release/2024-10-15
Release/2024-10-15
2 parents 6a95137 + c69773d commit 4be03fb

File tree

89 files changed

+2312
-1206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2312
-1206
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 2024-10-15
4+
- [PI-533] Create Product Team without FHIR
5+
36
## 2024-10-14
47
- [PI-534] Errors without FHIR
58

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024.10.14
1+
2024.10.15

changelog/2024-10-15.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [PI-533] Create Product Team without FHIR

docs/public_swagger/swagger.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -256,38 +256,6 @@ paths:
256256
application/fhir+json:
257257
schema:
258258
$ref: "#/components/schemas/OperationOutcome"
259-
/Organization:
260-
post:
261-
summary: Create an Organization resource
262-
operationId: createOrganization
263-
responses:
264-
"201":
265-
description: Create operation successful
266-
content:
267-
application/fhir+json:
268-
schema:
269-
$ref: "#/components/schemas/OperationOutcome"
270-
"4XX":
271-
description: "Client Error"
272-
content:
273-
application/fhir+json:
274-
schema:
275-
$ref: "#/components/schemas/OperationOutcome"
276-
requestBody:
277-
$ref: "#/components/requestBodies/Organization"
278-
parameters:
279-
- in: header
280-
name: version
281-
schema:
282-
$ref: "#/components/schemas/Version"
283-
- in: header
284-
name: x-request-id
285-
schema:
286-
$ref: "#/components/schemas/RequestId"
287-
- in: header
288-
name: x-correlation-id
289-
schema:
290-
$ref: "#/components/schemas/CorrelationId"
291259
/Organization/{id}:
292260
get:
293261
summary: Read an Organization resource

infrastructure/swagger/05_paths.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,6 @@ paths:
6767
- ${authoriser_name}: []
6868
- app-level0: []
6969

70-
/Organization:
71-
post:
72-
responses:
73-
"201":
74-
<<: *Response201
75-
"4XX":
76-
<<: *Response4XX
77-
<<: *RequestHeaders
78-
x-amazon-apigateway-integration:
79-
<<: *ApiGatewayIntegration
80-
uri: ${method_createProductTeam}
81-
security:
82-
- ${authoriser_name}: []
83-
- app-level0: []
84-
8570
/Organization/{id}:
8671
get:
8772
parameters:

infrastructure/swagger/swagger-fhir-generator-definitions/endpoints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
# RESTful API "Instance Level" or "Type Level" interactions
1010
# described in https://hl7.org/fhir/r4b/http.html
1111

12-
Organization: [create, read]
12+
Organization: [read]
1313
Device: [create, read, search]
1414
Product: [create, read]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "connecting-party-manager"
3-
version = "2024.10.14"
3+
version = "2024.10.15"
44
description = "Repository for the Connecting Party Manager API and related services"
55
authors = ["NHS England"]
66
license = "LICENSE.md"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
product_team_payload = {
2-
"id": "641be376-3954-4339-822c-54071c9ff1a0",
3-
"name": "123",
4-
"ods_code": "AAA",
2+
"keys": [{"key_type": "product_team_id_alias", "key_value": "BAR"}],
3+
"ods_code": "F5H1R",
4+
"name": "FOOBAR Product Team",
55
}
66

77
product_payload = {"product_name": "Foobar product"}

src/api/createCpmProduct/tests/test_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def _mock_test(version, params):
1919
org = Root.create_ods_organisation(ods_code=product_team_payload["ods_code"])
2020

2121
product_team = org.create_product_team(
22-
id=product_team_payload["id"], name=product_team_payload["name"]
22+
name=product_team_payload["name"], keys=product_team_payload["keys"]
2323
)
2424

2525
with mock_table(table_name=TABLE_NAME) as client, mock.patch.dict(
@@ -41,7 +41,7 @@ def _mock_test(version, params):
4141
event={
4242
"headers": {"version": version},
4343
"body": params,
44-
"pathParameters": {"product_team_id": product_team_payload["id"]},
44+
"pathParameters": {"product_team_id": product_team.id},
4545
}
4646
)
4747

src/api/createCpmProductForEpr/tests/test_index.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
from contextlib import contextmanager
44
from datetime import datetime
55
from unittest import mock
6-
from uuid import UUID
76

87
import pytest
98
from domain.core.cpm_system_id.v1 import PartyKeyId, ProductId
109
from domain.core.enum import Status
11-
from domain.core.root import Root
10+
from domain.core.root.v3 import Root
1211
from domain.repository.cpm_product_repository.v3 import CpmProductRepository
1312
from domain.repository.product_team_repository.v2 import ProductTeamRepository
1413
from event.json import json_loads
1514
from nhs_context_logging import app_logger
1615

1716
from test_helpers.dynamodb import mock_table
17+
from test_helpers.sample_data import CPM_PRODUCT_TEAM_NO_ID
1818
from test_helpers.uuid import consistent_uuid
1919

2020
TABLE_NAME = "hiya"
21-
22-
ODS_CODE = "AAA"
21+
ODS_CODE = "F5H1R"
2322
PRODUCT_TEAM_ID = consistent_uuid(1)
2423
PRODUCT_NAME = "My Product"
24+
PRODUCT_TEAM_KEYS = CPM_PRODUCT_TEAM_NO_ID["keys"]
2525
VERSION = 1
2626
RESOURCE_CREATED = {
2727
"resourceType": "OperationOutcome",
@@ -51,8 +51,10 @@
5151

5252
@contextmanager
5353
def mock_lambda():
54-
org = Root.create_ods_organisation(ods_code=ODS_CODE)
55-
product_team = org.create_product_team(id=PRODUCT_TEAM_ID, name=PRODUCT_NAME)
54+
org = Root.create_ods_organisation(ods_code=CPM_PRODUCT_TEAM_NO_ID["ods_code"])
55+
product_team = org.create_product_team(
56+
name=CPM_PRODUCT_TEAM_NO_ID["name"], keys=CPM_PRODUCT_TEAM_NO_ID["keys"]
57+
)
5658

5759
with mock_table(table_name=TABLE_NAME) as client, mock.patch.dict(
5860
os.environ,
@@ -68,20 +70,19 @@ def mock_lambda():
6870

6971
index.cache["DYNAMODB_CLIENT"] = client
7072

71-
yield index
73+
yield index, product_team
7274

7375

7476
def test_index():
75-
with mock_lambda() as index:
77+
with mock_lambda() as (index, product_team):
7678
# Execute the lambda
7779
response = index.handler(
7880
event={
7981
"headers": {"version": VERSION},
8082
"body": json.dumps({"product_name": PRODUCT_NAME}),
81-
"pathParameters": {"product_team_id": PRODUCT_TEAM_ID},
83+
"pathParameters": {"product_team_id": product_team.id},
8284
}
8385
)
84-
8586
# Validate that the response indicates that a resource was created
8687
assert response["statusCode"] == 201
8788
assert json_loads(response["body"]) == {
@@ -94,7 +95,7 @@ def test_index():
9495
table_name=TABLE_NAME, dynamodb_client=index.cache["DYNAMODB_CLIENT"]
9596
)
9697
created_product = repo.read(
97-
product_team_id=PRODUCT_TEAM_ID, product_id=response["headers"]["Location"]
98+
product_team_id=product_team.id, product_id=response["headers"]["Location"]
9899
).dict()
99100

100101
# Sense checks on the created resource
@@ -108,7 +109,7 @@ def test_index():
108109
"deleted_on": None,
109110
"name": PRODUCT_NAME,
110111
"ods_code": ODS_CODE,
111-
"product_team_id": UUID(PRODUCT_TEAM_ID),
112+
"product_team_id": product_team.id,
112113
"status": Status.ACTIVE,
113114
}
114115

@@ -143,7 +144,7 @@ def test_index():
143144
],
144145
)
145146
def test_incoming_errors(body, path_parameters, error_code, status_code):
146-
with mock_lambda() as index:
147+
with mock_lambda() as (index, product_team):
147148
# Execute the lambda
148149
response = index.handler(
149150
event={

0 commit comments

Comments
 (0)