storj/web/satellite/tests/unit/mock/api/accessGrants.ts
Jeremy Wharton e2abbc3800 web/satellite: use frontend config in store modules
References to the meta tag config values in Vuex store modules and
Pinia stores have been modified to instead refer to the frontend config
fetched through the satellite API.

References #5494

Change-Id: I2d16d8fa8f3159c45f00f506825b0c2119e475ff
2023-04-14 14:09:04 -05:00

43 lines
1.3 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import {
AccessGrant,
AccessGrantCursor,
AccessGrantsApi,
AccessGrantsPage,
EdgeCredentials,
} from '@/types/accessGrants';
/**
* Mock for AccessGrantsApi
*/
export class AccessGrantsMock implements AccessGrantsApi {
private readonly date = new Date(0);
private mockAccessGrantsPage: AccessGrantsPage;
public setMockAccessGrantsPage(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();
}
deleteByNameAndProjectID(_name: string, _projectID: string): Promise<void> {
return Promise.resolve();
}
getGatewayCredentials(_accessGrant: string, _requestURL: string): Promise<EdgeCredentials> {
return Promise.resolve(new EdgeCredentials('testCredId', new Date(), 'testAccessKeyId', 'testSecret', 'testEndpoint'));
}
}