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,
|
2022-01-26 12:14:44 +00:00
|
|
|
EdgeCredentials,
|
2020-11-24 22:29:19 +00:00
|
|
|
} 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();
|
|
|
|
}
|
|
|
|
|
2023-06-12 14:26:47 +01:00
|
|
|
getAllAPIKeyNames(_projectID: string): Promise<string[]> {
|
|
|
|
return Promise.resolve([]);
|
|
|
|
}
|
|
|
|
|
2023-04-05 22:36:03 +01:00
|
|
|
getGatewayCredentials(_accessGrant: string, _requestURL: string): Promise<EdgeCredentials> {
|
2022-01-26 12:14:44 +00:00
|
|
|
return Promise.resolve(new EdgeCredentials('testCredId', new Date(), 'testAccessKeyId', 'testSecret', 'testEndpoint'));
|
2020-11-24 22:29:19 +00:00
|
|
|
}
|
2020-11-16 15:16:51 +00:00
|
|
|
}
|