|
1 | 1 | package org.orcid.core.manager.v3.impl;
|
2 | 2 |
|
3 |
| -import static org.junit.Assert.assertEquals; |
4 |
| -import static org.junit.Assert.assertFalse; |
5 |
| -import static org.junit.Assert.assertNotNull; |
6 |
| -import static org.junit.Assert.assertNull; |
7 |
| -import static org.junit.Assert.assertTrue; |
8 |
| - |
9 |
| -import java.util.Arrays; |
10 |
| -import java.util.Date; |
11 |
| -import java.util.List; |
12 |
| - |
13 |
| -import javax.annotation.Resource; |
14 |
| - |
15 | 3 | import org.junit.AfterClass;
|
16 | 4 | import org.junit.Before;
|
17 | 5 | import org.junit.BeforeClass;
|
|
38 | 26 | import org.orcid.core.oauth.OrcidOauth2TokenDetailService;
|
39 | 27 | import org.orcid.core.profile.history.ProfileHistoryEventType;
|
40 | 28 | import org.orcid.jaxb.model.common.AvailableLocales;
|
| 29 | +import org.orcid.jaxb.model.message.ScopePathType; |
41 | 30 | import org.orcid.jaxb.model.v3.release.common.Visibility;
|
42 | 31 | import org.orcid.jaxb.model.v3.release.record.Address;
|
43 | 32 | import org.orcid.jaxb.model.v3.release.record.Addresses;
|
|
68 | 57 | import org.springframework.test.util.ReflectionTestUtils;
|
69 | 58 | import org.springframework.transaction.annotation.Transactional;
|
70 | 59 |
|
| 60 | +import javax.annotation.Resource; |
| 61 | +import java.util.Arrays; |
| 62 | +import java.util.Date; |
| 63 | +import java.util.List; |
| 64 | + |
| 65 | +import static org.junit.Assert.assertEquals; |
| 66 | +import static org.junit.Assert.assertFalse; |
| 67 | +import static org.junit.Assert.assertNotNull; |
| 68 | +import static org.junit.Assert.assertNull; |
| 69 | +import static org.junit.Assert.assertTrue; |
| 70 | + |
71 | 71 | /**
|
72 | 72 | * @author: Declan Newman (declan) Date: 10/02/2012
|
73 | 73 | */
|
@@ -326,12 +326,17 @@ public void testGetApplications() {
|
326 | 326 | List<ApplicationSummary> applications = profileEntityManager.getApplications(USER_ORCID);
|
327 | 327 | assertNotNull(applications);
|
328 | 328 | assertEquals(2, applications.size());
|
329 |
| - assertEquals(4, applications.get(0).getScopePaths().keySet().size()); |
330 |
| - assertEquals(2, applications.get(1).getScopePaths().keySet().size()); |
| 329 | + assertEquals(5, applications.get(0).getScopePaths().keySet().size()); |
| 330 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.READ_LIMITED.toString())); |
| 331 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ORCID_PROFILE_READ_LIMITED.toString())); |
| 332 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ACTIVITIES_UPDATE.toString())); |
| 333 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ACTIVITIES_READ_LIMITED.toString())); |
| 334 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ORCID_WORKS_READ_LIMITED.toString())); |
331 | 335 |
|
332 |
| - // test ordering based on name |
333 |
| - assertEquals(CLIENT_ID_1, applications.get(0).getOrcidPath()); |
334 |
| - assertEquals(CLIENT_ID_2, applications.get(1).getOrcidPath()); |
| 336 | + assertEquals(3, applications.get(1).getScopePaths().keySet().size()); |
| 337 | + assertTrue(applications.get(1).getScopePaths().keySet().contains(ScopePathType.READ_LIMITED.toString())); |
| 338 | + assertTrue(applications.get(1).getScopePaths().keySet().contains(ScopePathType.ORCID_PROFILE_READ_LIMITED.toString())); |
| 339 | + assertTrue(applications.get(1).getScopePaths().keySet().contains(ScopePathType.ACTIVITIES_UPDATE.toString())); |
335 | 340 |
|
336 | 341 | //Assert we can delete them
|
337 | 342 | profileEntityManager.disableClientAccess(CLIENT_ID_1, USER_ORCID);
|
@@ -364,7 +369,11 @@ public void testDontGetDuplicatedApplications() {
|
364 | 369 | assertEquals(1, applications.size());
|
365 | 370 |
|
366 | 371 | // scopes grouped by label - Read limited information from your biography., Read your information with visibility set to Trusted Parties, Add/update your research activities (works, affiliations, etc)
|
367 |
| - assertEquals(3, applications.get(0).getScopePaths().keySet().size()); |
| 372 | + assertEquals(4, applications.get(0).getScopePaths().keySet().size()); |
| 373 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.READ_LIMITED.toString())); |
| 374 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ORCID_PROFILE_READ_LIMITED.toString())); |
| 375 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.ACTIVITIES_UPDATE.toString())); |
| 376 | + assertTrue(applications.get(0).getScopePaths().keySet().contains(ScopePathType.PERSON_READ_LIMITED.toString())); |
368 | 377 |
|
369 | 378 | //Revoke them to check revoking one revokes all the ones with the same scopes
|
370 | 379 | profileEntityManager.disableClientAccess(CLIENT_ID_1, USER_ORCID);
|
|
0 commit comments