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;
|
|
|
|
|
|
|
|
public setMockApiKeysPage(mockAccessGrantsPage: AccessGrantsPage): void {
|
|
|
|
this.mockAccessGrantsPage = mockAccessGrantsPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
get(projectId: string, cursor: AccessGrantCursor): Promise<AccessGrantsPage> {
|
|
|
|
return Promise.resolve(this.mockAccessGrantsPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
create(projectId: string, name: string): Promise<AccessGrant> {
|
|
|
|
return Promise.resolve(new AccessGrant('testId', 'testName', this.date, 'testKey'));
|
|
|
|
}
|
|
|
|
|
|
|
|
delete(ids: string[]): Promise<void> {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
2020-11-24 22:29:19 +00:00
|
|
|
|
2021-03-18 18:09:04 +00:00
|
|
|
deleteByNameAndProjectID(name: string, projectID: string): Promise<void> {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
|
2021-03-18 19:22:46 +00: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
|
|
|
}
|