Skip to content
Snippets Groups Projects
Commit 03fe90c1 authored by Lennard Strohmeyer's avatar Lennard Strohmeyer :penguin:
Browse files

#109 fixed test case and added correct filter for consents

parent b3291453
No related branches found
Tags v1.0.1.rc6
No related merge requests found
Pipeline #1591938 passed
......@@ -878,16 +878,18 @@ class TestUserConsentSaveUpdatedProviderSchema(BaseTestCase):
)
self.assertEqual(response.status_code, 200)
user_consents = UserConsents.objects.filter(user__email=self.test_user_email)
user_consents = UserConsents.objects.filter(user__email=self.test_user_email, active=True)
self.assertEqual(len(user_consents), 2)
self.assertTrue(
UserConsents.objects.get(
verb="http://h5p.example.com/expapi/verbs/experienced"
verb="http://h5p.example.com/expapi/verbs/experienced",
active=True
).consented
)
self.assertTrue(
UserConsents.objects.get(
verb="http://h5p.example.com/expapi/verbs/attempted"
verb="http://h5p.example.com/expapi/verbs/attempted",
active=True
).consented
)
......
......@@ -195,7 +195,7 @@ def process_statement(x_api_statement, provider, latest_schema):
# has the user given consent to this verb?
# maybe TODO: load correct provider schema pertaining to this user consent to validate the verb and objects fully
user_consent = UserConsents.objects.filter(
user=user, provider=provider, verb=verb, consented=True, created__lte=timestamp
user=user, provider=provider, verb=verb, consented=True, created__lte=timestamp, active=True
).first()
if not user_consent:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment