Skip to content

Commit

Permalink
Merge pull request #3204 from HHS/ops-2362/fix-route
Browse files Browse the repository at this point in the history
OPS-2362: Fix GET documents routing in flask
  • Loading branch information
rajohnson90 authored Dec 11, 2024
2 parents 201b196 + a9e366a commit 7fe0a1a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion backend/ops_api/ops/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def register_api(api_bp: Blueprint) -> None:
view_func=CHANGE_REQUEST_REVIEW_API_VIEW_FUNC,
)
api_bp.add_url_rule(
"/documents/<int:agreement_id>/",
"/documents/<int:agreement_id>",
view_func=DOCUMENT_API_FUNC,
)
api_bp.add_url_rule(
Expand Down
39 changes: 21 additions & 18 deletions frontend/cypress/e2e/uploadDocument.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,27 @@ it("should create a document database record and upload to in memory storage", (
// Verifying the document database record exists
expect(localStorage.getItem("access_token")).to.exist;
const bearer_token = `Bearer ${window.localStorage.getItem("access_token")}`;
cy.request({
method: "GET",
url: "http://localhost:8080/api/v1/documents/1",
headers: {
Authorization: bearer_token,
"Content-Type": "application/json",
Accept: "application/json"
}
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.url).to.exist;
expect(response.body.url).to.include("FakeDocumentRepository");
expect(response.body.documents).to.exist;
expect(response.body.documents[0].document_name).to.eq("sample_document.xlsx");
expect(response.body.documents[0].document_type).to.eq("DocumentType.ADDITIONAL_DOCUMENT");
expect(response.body.documents[0].agreement_id).to.eq(1);
expect(response.body.documents[0].status).to.eq("uploaded");
});
cy.wait(2000).then(() => {
cy.request({
method: "GET",
url: "http://localhost:8080/api/v1/documents/1",
headers: {
Authorization: bearer_token,
"Content-Type": "application/json",
Accept: "application/json"
}
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.url).to.exist;
expect(response.body.url).to.include("FakeDocumentRepository");
expect(response.body.documents).to.exist;
const mostRecentDoc = response.body.documents.length - 1;
expect(response.body.documents[mostRecentDoc].document_name).to.eq("sample_document.xlsx");
expect(response.body.documents[mostRecentDoc].document_type).to.eq("DocumentType.ADDITIONAL_DOCUMENT");
expect(response.body.documents[mostRecentDoc].agreement_id).to.eq(1);
expect(response.body.documents[mostRecentDoc].status).to.eq("uploaded");
});
})
});

it.skip("Should download document in memory storage and verify logs", () => {
Expand Down

0 comments on commit 7fe0a1a

Please sign in to comment.