fixed issues after merging

This commit is contained in:
lotte
2019-05-27 15:09:51 +02:00
parent a0a0830e5f
commit 35f73708ef
7 changed files with 148 additions and 80 deletions

View File

@@ -35,95 +35,103 @@ describe('AuthResponseParsingService', () => {
});
describe('parse', () => {
const validRequest = new AuthPostRequest(
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
'https://rest.api/dspace-spring-rest/api/authn/login',
'password=test&user=myself@testshib.org');
let validRequest;
let validRequest2;
let validResponse;
let validResponse1;
let validResponse2;
beforeEach(() => {
const validRequest2 = new AuthGetRequest(
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
'https://rest.api/dspace-spring-rest/api/authn/status');
validRequest = new AuthPostRequest(
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
'https://rest.api/dspace-spring-rest/api/authn/login',
'password=test&user=myself@testshib.org');
const validResponse = {
payload: {
authenticated: true,
id: null,
okay: true,
token: {
accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
expires: 1526318322000
},
} as AuthStatus,
statusCode: 200,
statusText: '200'
};
validRequest2 = new AuthGetRequest(
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
'https://rest.api/dspace-spring-rest/api/authn/status');
const validResponse1 = {
payload: {},
statusCode: 404,
statusText: '404'
};
validResponse = {
payload: {
authenticated: true,
id: null,
okay: true,
token: {
accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
expires: 1526318322000
},
} as AuthStatus,
statusCode: 200,
statusText: '200'
};
const validResponse2 = {
payload: {
authenticated: true,
id: null,
okay: true,
type: 'status',
_embedded: {
eperson: {
canLogIn: true,
email: 'myself@testshib.org',
groups: [],
handle: null,
id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
lastActive: '2018-05-14T17:03:31.277+0000',
metadata: {
'eperson.firstname': [
{
language: null,
value: 'User'
validResponse1 = {
payload: {},
statusCode: 404,
statusText: '404'
};
validResponse2 = {
payload: {
authenticated: true,
id: null,
okay: true,
type: 'status',
_embedded: {
eperson: {
canLogIn: true,
email: 'myself@testshib.org',
groups: [],
handle: null,
id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
lastActive: '2018-05-14T17:03:31.277+0000',
metadata: {
'eperson.firstname': [
{
language: null,
value: 'User'
}
],
'eperson.lastname': [
{
language: null,
value: 'Test'
}
],
'eperson.language': [
{
language: null,
value: 'en'
}
]
},
name: 'User Test',
netid: 'myself@testshib.org',
requireCertificate: false,
selfRegistered: false,
type: 'eperson',
uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
_links: {
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
}
],
'eperson.lastname': [
{
language: null,
value: 'Test'
}
],
'eperson.language': [
{
language: null,
value: 'en'
}
]
},
name: 'User Test',
netid: 'myself@testshib.org',
requireCertificate: false,
selfRegistered: false,
type: 'eperson',
uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
_links: {
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
}
}
},
_links: {
eperson: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
},
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
}
}
},
_links: {
eperson: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
},
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
}
}
},
statusCode: 200,
statusText: '200'
statusCode: 200,
statusText: '200'
};
};
});
it('should return a AuthStatusResponse if data contains a valid AuthStatus object as payload', () => {
const response = service.parse(validRequest, validResponse);

View File

@@ -107,6 +107,12 @@ import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing
import { ClaimedTaskDataService } from './tasks/claimed-task-data.service';
import { PoolTaskDataService } from './tasks/pool-task-data.service';
import { TaskResponseParsingService } from './tasks/task-response-parsing.service';
import { NormalizedClaimedTask } from './tasks/models/normalized-claimed-task-object.model';
import { NormalizedTaskObject } from './tasks/models/normalized-task-object.model';
import { NormalizedPoolTask } from './tasks/models/normalized-pool-task-object.model';
import { NormalizedRelationship } from './cache/models/items/normalized-relationship.model';
import { NormalizedRelationshipType } from './cache/models/items/normalized-relationship-type.model';
import { NormalizedItemType } from './cache/models/items/normalized-item-type.model';
const IMPORTS = [
CommonModule,
@@ -227,7 +233,13 @@ export const normalizedModels =
NormalizedSubmissionSectionModel,
NormalizedAuthStatus,
NormalizedAuthorityValue,
BrowseEntry
BrowseEntry,
NormalizedClaimedTask,
NormalizedTaskObject,
NormalizedPoolTask,
NormalizedRelationship,
NormalizedRelationshipType,
NormalizedItemType
];
@NgModule({

View File

@@ -31,6 +31,20 @@ export class NormalizedClaimedTask extends NormalizedTaskObject<ClaimedTask> {
@autoserialize
action: string;
/**
* The eperson object for this task
*/
@autoserialize
@relationship(ResourceType.EPerson, false)
eperson: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/**
* The workflowitem object whom this task is related
*/

View File

@@ -31,6 +31,13 @@ export class NormalizedPoolTask extends NormalizedTaskObject<PoolTask> {
@autoserialize
action: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/**
* The workflowitem object whom this task is related
*/

View File

@@ -30,6 +30,20 @@ export abstract class NormalizedTaskObject<T extends DSpaceObject> extends Norma
@autoserialize
action: string;
/**
* The eperson object for this task
*/
@autoserialize
@relationship(ResourceType.EPerson, false)
eperson: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/**
* The workflowitem object whom this task is related
*/

View File

@@ -5,6 +5,8 @@ import { DSpaceObject } from '../../shared/dspace-object.model';
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
import { RemoteData } from '../../data/remote-data';
import { WorkflowItem } from '../../submission/models/workflowitem.model';
import { Group } from '../../eperson/models/group.model';
import { EPerson } from '../../eperson/models/eperson.model';
/**
* An abstract model class for a TaskObject.
@@ -26,6 +28,16 @@ export class TaskObject extends DSpaceObject implements CacheableObject, Listabl
*/
action: string;
/**
* The group of this task
*/
eperson: Observable<RemoteData<EPerson>>;
/**
* The group of this task
*/
group: Observable<RemoteData<Group>>;
/**
* The workflowitem object whom this task is related
*/

View File

@@ -10,6 +10,7 @@ import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/cla
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
let component: ClaimedMyDSpaceResultListElementComponent;
let fixture: ComponentFixture<ClaimedMyDSpaceResultListElementComponent>;