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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ENHANCEMENTS:
* Pass OIDC vars directly to the devcontainer ([#4871](https://github.com/microsoft/AzureTRE/issues/4871))

BUG FIXES:
* Fix OpenAPI/schema sample generation for `get_sample_operation` step parameters. ([#4864](https://github.com/microsoft/AzureTRE/issues/4864))
* Fix test airlock request sample data fields and enum values. ([#4866](https://github.com/microsoft/AzureTRE/issues/4866))
* Fix property substitution not occuring where there is only a main step in the pipeline ([#4824](https://github.com/microsoft/AzureTRE/issues/4824))
* Fix Mysql template ignored storage_mb ([#4846](https://github.com/microsoft/AzureTRE/issues/4846))
* Fix duplicate `TOPIC_SUBSCRIPTION_NAME` in `core/terraform/airlock/airlock_processor.tf` ([#4847](https://github.com/microsoft/AzureTRE/pull/4847))
Expand Down
2 changes: 1 addition & 1 deletion api_app/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.25.14"
__version__ = "0.25.15"
6 changes: 3 additions & 3 deletions api_app/models/schemas/airlock_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

def get_sample_airlock_review(airlock_review_id: str) -> dict:
return {
"reviewId": airlock_review_id,
"reviewDecision": "Describe why the request was approved/rejected",
"id": airlock_review_id,
"reviewDecision": "approved",
"decisionExplanation": "Describe why the request was approved/rejected"
}


def get_sample_airlock_request(workspace_id: str, airlock_request_id: str) -> dict:
return {
"requestId": airlock_request_id,
"id": airlock_request_id,
"workspaceId": workspace_id,
"status": "draft",
"type": "import",
Expand Down
3 changes: 2 additions & 1 deletion api_app/models/schemas/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def get_sample_operation(operation_id: str) -> dict:
"updatedWhen": 1642611942.423857,
"steps": [
{
"stepId": "main",
"id": "7d96130f-b323-4b95-8351-a05e943d51a2",
"templateStepId": "main",
"stepTitle": "deployment for main",
"resourceId": "933ad738-7265-4b5f-9eae-a1a62928772e",
"resourceTemplateName": "tre-workspace-base",
Expand Down
18 changes: 18 additions & 0 deletions api_app/tests_ma/test_models/test_airlock_request_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from models.schemas.airlock_request import AirlockRequestAndOperationInResponse, get_sample_airlock_request
from models.schemas.operation import get_sample_operation


def test_airlock_request_and_operation_in_response_schema_is_valid():
workspace_id = "933ad738-7265-4b5f-9eae-a1a62928772e"
airlock_request_id = "121e921f-a4aa-44b3-90a9-e8da030495ef"
operation_id = "121e921f-a4aa-44b3-90a9-e8da030495ef"

sample_data = {
"airlockRequest": get_sample_airlock_request(workspace_id, airlock_request_id),
"operation": get_sample_operation(operation_id)
}

# This validates the schema extra example logic
response = AirlockRequestAndOperationInResponse(**sample_data)
assert response.airlockRequest.id == airlock_request_id
assert response.operation.id == operation_id
35 changes: 35 additions & 0 deletions api_app/tests_ma/test_models/test_operation_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from models.domain.operation import Operation
from models.schemas.operation import get_sample_operation, OperationInResponse, OperationInList


def test_get_sample_operation_is_valid():
operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132"
sample_operation_dict = get_sample_operation(operation_id)

# This will raise a ValidationError if the dictionary doesn't match the Operation model
operation = Operation(**sample_operation_dict)

assert operation.id == operation_id
assert len(operation.steps) > 0
assert operation.steps[0].templateStepId == "main"


def test_operation_in_response_schema_is_valid():
operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132"
sample_data = {
"operation": get_sample_operation(operation_id)
}
# This validates the schema extra example logic
response = OperationInResponse(**sample_data)
assert response.operation.id == operation_id


def test_operation_in_list_schema_is_valid():
operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132"
sample_data = {
"operations": [get_sample_operation(operation_id)]
}
# This validates the schema extra example logic
op_list = OperationInList(**sample_data)
assert len(op_list.operations) == 1
assert op_list.operations[0].id == operation_id
Loading