From 75db77dee1d10f7a72d733338822e983af437679 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 16 Jun 2023 16:17:01 +0200 Subject: [PATCH] nextcloud: Add tests for downloading and deleting WebDAV file --- packages/nextcloud/test/webdav.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/nextcloud/test/webdav.dart b/packages/nextcloud/test/webdav.dart index 2b6db36b..8dbebeab 100644 --- a/packages/nextcloud/test/webdav.dart +++ b/packages/nextcloud/test/webdav.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; +import 'package:crypto/crypto.dart'; import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; @@ -141,6 +142,18 @@ Future run(final DockerImage image) async { ); }); + test('Download file', () async { + final response = await client.webdav.download('Nextcloud.png'); + expect(sha1.convert(response).toString(), '5ab8040bc0e9a3c47f45abd8a6d44f6e381ba6ed'); + }); + + test('Delete file', () async { + final response = await client.webdav.delete('Nextcloud.png'); + expect(response.statusCode, 204); + final responses = (await client.webdav.ls('/')).responses; + expect(responses.where((final response) => response.href!.endsWith('/Nextcloud.png')), hasLength(0)); + }); + test('Copy file', () async { final response = await client.webdav.copy( 'Nextcloud.png',