mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 09:14:58 +03:00
chore: remove axios dependency from CLI (#6888)
This commit is contained in:
@@ -14,10 +14,10 @@ export const setup = async () => {
|
||||
await api.authenticationApi.signUpAdmin({
|
||||
signUpDto: { email: 'cli@immich.app', password: 'password', name: 'Administrator' },
|
||||
});
|
||||
const { data: admin } = await api.authenticationApi.login({
|
||||
const admin = await api.authenticationApi.login({
|
||||
loginCredentialDto: { email: 'cli@immich.app', password: 'password' },
|
||||
});
|
||||
const { data: apiKey } = await api.keyApi.createApiKey(
|
||||
const apiKey = await api.keyApi.createApiKey(
|
||||
{ aPIKeyCreateDto: { name: 'CLI Test' } },
|
||||
{ headers: { Authorization: `Bearer ${admin.accessToken}` } },
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ describe(`login-key (e2e)`, () => {
|
||||
|
||||
it('should error when providing an invalid API key', async () => {
|
||||
await expect(new LoginCommand(CLI_BASE_OPTIONS).run(instanceUrl, 'invalid')).rejects.toThrow(
|
||||
`Failed to connect to server ${instanceUrl}: Request failed with status code 401`,
|
||||
`Failed to connect to server ${instanceUrl}: Response returned an error code`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ describe(`upload (e2e)`, () => {
|
||||
|
||||
it('should upload a folder recursively', async () => {
|
||||
await new UploadCommand(CLI_BASE_OPTIONS).run([`${IMMICH_TEST_ASSET_PATH}/albums/nature/`], { recursive: true });
|
||||
const { data: assets } = await api.assetApi.getAllAssets({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
const assets = await api.assetApi.getAllAssets({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
expect(assets.length).toBeGreaterThan(4);
|
||||
});
|
||||
|
||||
it('should not create a new album', async () => {
|
||||
await new UploadCommand(CLI_BASE_OPTIONS).run([`${IMMICH_TEST_ASSET_PATH}/albums/nature/`], { recursive: true });
|
||||
const { data: albums } = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
const albums = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
expect(albums.length).toEqual(0);
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ describe(`upload (e2e)`, () => {
|
||||
album: true,
|
||||
});
|
||||
|
||||
const { data: albums } = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
const albums = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
expect(albums.length).toEqual(1);
|
||||
const natureAlbum = albums[0];
|
||||
expect(natureAlbum.albumName).toEqual('nature');
|
||||
@@ -59,7 +59,7 @@ describe(`upload (e2e)`, () => {
|
||||
album: true,
|
||||
});
|
||||
|
||||
const { data: albums } = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
const albums = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
expect(albums.length).toEqual(1);
|
||||
const natureAlbum = albums[0];
|
||||
expect(natureAlbum.albumName).toEqual('nature');
|
||||
@@ -71,7 +71,7 @@ describe(`upload (e2e)`, () => {
|
||||
albumName: 'testAlbum',
|
||||
});
|
||||
|
||||
const { data: albums } = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
const albums = await api.albumApi.getAllAlbums({}, { headers: { 'x-api-key': api.apiKey } });
|
||||
expect(albums.length).toEqual(1);
|
||||
const testAlbum = albums[0];
|
||||
expect(testAlbum.albumName).toEqual('testAlbum');
|
||||
|
||||
Reference in New Issue
Block a user