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
public void testPreferences() throws Exception {
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "end-user", null, "test");
ePersonService.addMetadata(context, eperson, "dspace", "agreements", "cookies", null,
"Dspace cookies agreement metadata");
String cookies =
"{" +
"\"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();
assertEquals(
"test",
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "end-user", null)
cookies,
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "cookies", null)
);
assertEquals(
"Dspace cookies agreement metadata",
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "cookies", null)
"true",
ePersonService.getMetadataFirstValue(eperson, "dspace", "agreements", "end-user", null)
);
}

View File

@@ -20,14 +20,14 @@
<schema>dspace</schema>
<element>agreements</element>
<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>
<schema>dspace</schema>
<element>agreements</element>
<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>
</dspace-dc-types>