2019-09-27 15:41:04 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import { ApiKey, ApiKeyCursor, ApiKeysApi, ApiKeysPage } from '@/types/apiKeys';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mock for ApiKeysApi
|
|
|
|
*/
|
|
|
|
export class ApiKeysMock implements ApiKeysApi {
|
2020-09-28 14:44:01 +01:00
|
|
|
private readonly date = new Date(0);
|
2019-10-17 11:34:45 +01:00
|
|
|
private mockApiKeysPage: ApiKeysPage;
|
|
|
|
|
|
|
|
public setMockApiKeysPage(mockApiKeysPage: ApiKeysPage): void {
|
|
|
|
this.mockApiKeysPage = mockApiKeysPage;
|
|
|
|
}
|
|
|
|
|
2019-09-27 15:41:04 +01:00
|
|
|
get(projectId: string, cursor: ApiKeyCursor): Promise<ApiKeysPage> {
|
2019-10-17 11:34:45 +01:00
|
|
|
return Promise.resolve(this.mockApiKeysPage);
|
2019-09-27 15:41:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
create(projectId: string, name: string): Promise<ApiKey> {
|
2020-09-28 14:44:01 +01:00
|
|
|
return Promise.resolve(new ApiKey('testId', 'testName', this.date, 'testKey'));
|
2019-09-27 15:41:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
delete(ids: string[]): Promise<void> {
|
2020-06-02 17:38:44 +01:00
|
|
|
return Promise.resolve();
|
2019-09-27 15:41:04 +01:00
|
|
|
}
|
|
|
|
}
|