Skip to content

Commit

Permalink
Improve test coverage on the method that fetches fides user device id…
Browse files Browse the repository at this point in the history
… provided identity.
  • Loading branch information
pattisdr committed Apr 24, 2023
1 parent b3c8366 commit b82b6ea
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/ops/api/v1/endpoints/test_consent_request_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import pytest
from requests import Session

from fides.api.ops.api.v1.endpoints.consent_request_endpoints import (
_get_fides_user_device_id_provided_identity,
)
from fides.api.ops.api.v1.scope_registry import CONNECTION_READ, CONSENT_READ
from fides.api.ops.api.v1.urn_registry import (
CONSENT_REQUEST,
Expand Down Expand Up @@ -1165,3 +1168,23 @@ def test_get_consent_preferences(
},
]
assert response.json()["consent"] == expected_consent_data


class TestGetFidesUserProvidedIdentity:
def test_no_identifier_supplied(self, db):
provided_identity = _get_fides_user_device_id_provided_identity(db, None)
assert provided_identity is None

def test_no_provided_identifier_exists(self, db):
provided_identity = _get_fides_user_device_id_provided_identity(
db, "fides_user_device_id"
)
assert provided_identity is None

def test_get_fides_user_device_id_provided_identity(
self, db, fides_user_provided_identity
):
provided_identity = _get_fides_user_device_id_provided_identity(
db, "FGHIJ_TEST_FIDES"
)
assert provided_identity == fides_user_provided_identity

0 comments on commit b82b6ea

Please sign in to comment.