taskid 72455 Cookie Preferences per account - add scope notes and more realistic test value

This commit is contained in:
Samuel
2020-08-28 15:26:22 +02:00
parent 1773b40acb
commit 8adc7e5c31
2 changed files with 18 additions and 9 deletions

View File

@@ -81,18 +81,27 @@ public class EPersonTest extends AbstractUnitTest {
@Test @Test
public void testPreferences() throws Exception { public void testPreferences() throws Exception {
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "end-user", null, "test"); String cookies =
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "cookies", null, "{" +
"Dspace cookies agreement metadata"); "\"token_item\":true," +
"\"impersonation\":true," +
"\"redirect\":true," +
"\"language\":true," +
"\"klaro\":true," +
"\"google-analytics\":false" +
"}";
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "cookies", null, cookies);
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "end-user", null, "true");
context.commit(); context.commit();
assertEquals( assertEquals(
"test", cookies,
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "end-user", null) ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "cookies", null)
); );
assertEquals( assertEquals(
"Dspace cookies agreement metadata", "true",
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "cookies", null) ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "end-user", null)
); );
} }

View File

@@ -20,14 +20,14 @@
<schema>dspace</schema> <schema>dspace</schema>
<element>agreements</element> <element>agreements</element>
<qualifier>end-user</qualifier> <qualifier>end-user</qualifier>
<scope_note></scope_note> <scope_note>Stores whether the End User Agreement has been accepted by an EPerson. Valid values; true, false</scope_note>
</dc-type> </dc-type>
<dc-type> <dc-type>
<schema>dspace</schema> <schema>dspace</schema>
<element>agreements</element> <element>agreements</element>
<qualifier>cookies</qualifier> <qualifier>cookies</qualifier>
<scope_note></scope_note> <scope_note>Stores the cookie preferences of an EPerson, as selected in last session. Value will be an array of cookieName/boolean pairs, specifying which cookies are allowed or not allowed.</scope_note>
</dc-type> </dc-type>
</dspace-dc-types> </dspace-dc-types>