2020-11-16 15:16:51 +00:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2020-11-24 22:29:19 +00:00
|
|
|
import {
|
|
|
|
AccessGrant,
|
|
|
|
AccessGrantCursor,
|
|
|
|
AccessGrantsApi,
|
|
|
|
AccessGrantsPage,
|
|
|
|
GatewayCredentials,
|
|
|
|
} from '@/types/accessGrants';
|
2020-11-16 15:16:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mock for AccessGrantsApi
|
|
|
|
*/
|
|
|
|
export class AccessGrantsMock implements AccessGrantsApi {
|
|
|
|
private readonly date = new Date(0);
|
|
|
|
private mockAccessGrantsPage: AccessGrantsPage;
|
|
|
|
|
2021-06-09 16:13:19 +01:00
|
|
|
public setMockAccessGrantsPage(mockAccessGrantsPage: AccessGrantsPage): void {
|
2020-11-16 15:16:51 +00:00
|
|
|
this.mockAccessGrantsPage = mockAccessGrantsPage;
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
get(_projectId: string, _cursor: AccessGrantCursor): Promise<AccessGrantsPage> {
|
2020-11-16 15:16:51 +00:00
|
|
|
return Promise.resolve(this.mockAccessGrantsPage);
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
create(_projectId: string, _name: string): Promise<AccessGrant> {
|
2020-11-16 15:16:51 +00:00
|
|
|
return Promise.resolve(new AccessGrant('testId', 'testName', this.date, 'testKey'));
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
delete(_ids: string[]): Promise<void> {
|
2020-11-16 15:16:51 +00:00
|
|
|
return Promise.resolve();
|
|
|
|
}
|
2020-11-24 22:29:19 +00:00
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
deleteByNameAndProjectID(_name: string, _projectID: string): Promise<void> {
|
2021-03-18 18:09:04 +00:00
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
getGatewayCredentials(_accessGrant: string, _optionalURL?: string): Promise<GatewayCredentials> {
|
2020-11-24 22:29:19 +00:00
|
|
|
return Promise.resolve(new GatewayCredentials('testCredId', new Date(), 'testAccessKeyId', 'testSecret', 'testEndpoint'));
|
|
|
|
}
|
2020-11-16 15:16:51 +00:00
|
|
|
}
|