Skip to content

Commit ba5795b

Browse files
committed
Add 'state' field to FileUpload and fix test that was broken by recent change
1 parent 89e44e0 commit ba5795b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/uos/core/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,17 @@ class FileUploadBox(BaseModel):
4747
storage_alias: str = Field(..., description="S3 storage alias to use for uploads")
4848

4949

50+
FileUploadState = Literal["init", "inbox", "archived"]
51+
# init = file upload initiated, but not yet finished
52+
# inbox = file upload complete, file in inbox
53+
# archived = file moved out of inbox after completion
54+
55+
5056
class FileUpload(BaseModel):
5157
"""A File Upload. These objects are owned by the UCS."""
5258

5359
upload_id: UUID4 = Field(..., description="Unique identifier for the file upload")
60+
state: FileUploadState = "init"
5461
completed: bool = Field(
5562
default=False, description="Whether or not the file upload has finished"
5663
)

tests/integration/test_typical_journey.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ async def test_typical_journey(joint_fixture: JointFixture, httpx_mock: HTTPXMoc
125125
title="Updated Test Box",
126126
description="Updated description",
127127
)
128-
httpx_mock.add_response( # mock call that checks if DS has access to box
129-
method="GET",
130-
url=f"{access_url}/upload-access/users/{ds_user_id}/boxes/{box_id}",
131-
status_code=200,
132-
)
133128
async with (
134129
joint_fixture.kafka.record_events(in_topic=audit_topic) as audit_event_recorder,
135130
joint_fixture.kafka.record_events(
@@ -181,7 +176,7 @@ async def test_typical_journey(joint_fixture: JointFixture, httpx_mock: HTTPXMoc
181176
)
182177
updated_box = await joint_fixture.upload_orchestrator.get_research_data_upload_box(
183178
box_id=box_id,
184-
user_id=regular_user_id,
179+
auth_context=user_auth_context,
185180
)
186181
assert updated_box.title == "Updated Test Box"
187182
assert updated_box.description == "Updated description"
@@ -204,6 +199,6 @@ async def test_typical_journey(joint_fixture: JointFixture, httpx_mock: HTTPXMoc
204199
# Verify the box is now locked
205200
final_box = await joint_fixture.upload_orchestrator.get_research_data_upload_box(
206201
box_id=box_id,
207-
user_id=regular_user_id,
202+
auth_context=user_auth_context,
208203
)
209204
assert final_box.state == ResearchDataUploadBoxState.LOCKED

0 commit comments

Comments
 (0)