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)), + ); + }); }); }