Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Instead of using a new VerificationCode schema, use the SubjectIdenti…
Browse files Browse the repository at this point in the history
…tyVerificationBodyParams that already exists.
  • Loading branch information
pattisdr committed Aug 19, 2022
1 parent d7603f6 commit 40fcf6d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
CollectionAddressResponse,
DryRunDatasetResponse,
)
from fidesops.ops.schemas.email.email import SubjectIdentityVerificationBodyParams
from fidesops.ops.schemas.external_https import PrivacyRequestResumeFormat
from fidesops.ops.schemas.privacy_request import (
BulkPostPrivacyRequests,
Expand All @@ -82,7 +83,6 @@
ReviewPrivacyRequestIds,
RowCountRequest,
StoppedCollection,
VerificationCode,
)
from fidesops.ops.service.privacy_request.request_runner_service import (
queue_privacy_request,
Expand Down Expand Up @@ -971,7 +971,7 @@ def verify_identification_code(
privacy_request_id: str,
*,
db: Session = Depends(deps.get_db),
provided_code: VerificationCode,
provided_code: SubjectIdentityVerificationBodyParams,
) -> PrivacyRequestResponse:
"""Verify the supplied identity verification code
Expand All @@ -983,7 +983,7 @@ def verify_identification_code(
db, privacy_request_id
)
try:
privacy_request.verify_identity(db, provided_code.code)
privacy_request.verify_identity(db, provided_code.access_code)
except IdentityVerificationException as exc:
raise HTTPException(status_code=HTTP_400_BAD_REQUEST, detail=exc.message)
except PermissionError as exc:
Expand Down
6 changes: 0 additions & 6 deletions src/fidesops/ops/schemas/privacy_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ class StoppedCollectionDetails(StoppedCollection):
collection: Optional[str] = None # type: ignore


class VerificationCode(BaseSchema):
"""Request Body for the user to supply their identity verification code"""

code: str


class PrivacyRequestResponse(BaseSchema):
"""Schema to check the status of a PrivacyRequest"""

Expand Down
10 changes: 5 additions & 5 deletions tests/ops/api/v1/endpoints/test_privacy_request_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ def url(self, db, privacy_request):
)

def test_incorrect_privacy_request_status(self, api_client, url, privacy_request):
request_body = {"code": self.code}
request_body = {"access_code": self.code}
resp = api_client.post(url, headers={}, json=request_body)
assert resp.status_code == 400
assert (
Expand All @@ -2435,7 +2435,7 @@ def test_verification_code_expired(self, db, api_client, url, privacy_request):
privacy_request.status = PrivacyRequestStatus.identity_unverified
privacy_request.save(db)

request_body = {"code": self.code}
request_body = {"access_code": self.code}
resp = api_client.post(url, headers={}, json=request_body)
assert resp.status_code == 400
assert (
Expand All @@ -2448,7 +2448,7 @@ def test_invalid_code(self, db, api_client, url, privacy_request):
privacy_request.save(db)
privacy_request.cache_identity_verification_code("999999")

request_body = {"code": self.code}
request_body = {"access_code": self.code}
resp = api_client.post(url, headers={}, json=request_body)
assert resp.status_code == 403
assert (
Expand All @@ -2466,7 +2466,7 @@ def test_verify_identity_no_admin_approval_needed(
privacy_request.save(db)
privacy_request.cache_identity_verification_code(self.code)

request_body = {"code": self.code}
request_body = {"access_code": self.code}
resp = api_client.post(url, headers={}, json=request_body)
assert resp.status_code == 200

Expand Down Expand Up @@ -2506,7 +2506,7 @@ def test_verify_identity_admin_approval_needed(
privacy_request.save(db)
privacy_request.cache_identity_verification_code(self.code)

request_body = {"code": self.code}
request_body = {"access_code": self.code}
resp = api_client.post(url, headers={}, json=request_body)
assert resp.status_code == 200

Expand Down

0 comments on commit 40fcf6d

Please sign in to comment.