From 6b8dc24bd4e4f2fcbff2e7644886b578223b0af1 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 16 Jun 2023 20:30:30 +0200 Subject: [PATCH] nextcloud: Add some more core tests --- packages/nextcloud/test/core.dart | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/nextcloud/test/core.dart b/packages/nextcloud/test/core.dart index 2520e413..596b25e1 100644 --- a/packages/nextcloud/test/core.dart +++ b/packages/nextcloud/test/core.dart @@ -1,3 +1,4 @@ +import 'package:crypto/crypto.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; @@ -98,5 +99,33 @@ Future run(final DockerImage image) async { expect(response.ocs.data[2].subline, ''); expect(response.ocs.data[2].shareWithDisplayNameUnique, ''); }); + + test('Get preview', () async { + final response = await client.core.getPreview(file: 'Nextcloud.png'); + expect(sha1.convert(response).toString(), '168c31b76ae4e8bdc5f8edd4c896f40e9d4afe1e'); + }); + + test('Get avatar', () async { + final response = await client.core.getAvatar(userId: 'admin', size: 32); + expect(sha1.convert(response).toString(), '618830d6512203281de64cc738e8a7b0cc3d1f47'); + }); + + test('Get dark avatar', () async { + final response = await client.core.getDarkAvatar(userId: 'admin', size: 32); + expect(sha1.convert(response).toString(), 'e7294d71b817d05940574061008c80a7d7a04b87'); + }); + + test('Delete app password', () async { + client = await getTestClient( + container, + useAppPassword: true, + ); + + await client.core.deleteAppPassword(); + expect( + () => client.core.getCapabilities(), + throwsA(predicate((final e) => (e! as NextcloudApiException).statusCode == 401)), + ); + }); }); }