Browse Source

nextcloud: Add some more core tests

pull/393/head
jld3103 1 year ago
parent
commit
6b8dc24bd4
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 29
      packages/nextcloud/test/core.dart

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

Loading…
Cancel
Save