@@ -3,7 +3,7 @@ import 'dart:convert';
33import 'dart:math' ;
44import 'dart:typed_data' ;
55
6- import 'package:http/http.dart' ;
6+ import 'package:http/http.dart' as http ;
77import 'package:http/testing.dart' ;
88import 'package:mocktail/mocktail.dart' ;
99import 'package:nextcloud/core.dart' as core;
@@ -82,10 +82,10 @@ void main() {
8282 late FileStat fileStat;
8383
8484 setUpAll (() {
85- registerFallbackValue (Request ('get' , Uri ()) as BaseRequest );
85+ registerFallbackValue (http. Request ('get' , Uri ()) as http. BaseRequest );
8686
8787 final mockClient = MockClient ((request) async {
88- return Response ('' , 400 );
88+ return http. Response ('' , 400 );
8989 });
9090
9191 client = WebDavClient (
@@ -162,7 +162,7 @@ void main() {
162162 final file = File ('test/files/test.png' );
163163 await tester.client.webdav.putFile (file, file.statSync (), PathUri .parse ('test/test.png' ));
164164
165- final response = await tester.client.webdav.propfind (
165+ var response = await tester.client.webdav.propfind (
166166 PathUri .parse ('test/test.png' ),
167167 prop: const WebDavPropWithoutValues .fromBools (
168168 davCreationdate: true ,
@@ -226,7 +226,7 @@ void main() {
226226 ),
227227 );
228228
229- final props = response.responses.first.propstats.first.prop;
229+ var props = response.responses.first.propstats.first.prop;
230230 expect (props.davCreationdate! .isBefore (DateTime .timestamp ()), isTrue);
231231 expect (props.davDisplayname, 'test.png' );
232232 expect (props.davGetcontentlanguage, isNull);
@@ -284,14 +284,81 @@ void main() {
284284 expect (props.ocTags! .tags, isNull);
285285 expect (json.decode (props.ocmSharePermissions! ), ['share' , 'read' , 'write' ]);
286286 expect (props.ocsSharePermissions, 19 );
287+
288+ response = await tester.client.webdav.propfind (PathUri .parse ('test/test.png' ));
289+
290+ props = response.responses.first.propstats.first.prop;
291+ expect (props.davCreationdate, isNull);
292+ expect (props.davDisplayname, isNull);
293+ expect (props.davGetcontentlanguage, isNull);
294+ expect (props.davGetcontentlength, 8650 );
295+ expect (props.davGetcontenttype, 'image/png' );
296+ expect (props.davGetetag, isNotEmpty);
297+ expect (props.davGetlastmodified! .isBefore (DateTime .timestamp ()), isTrue);
298+ expect (props.davQuotaAvailableBytes, isNull);
299+ expect (props.davQuotaUsedBytes, isNull);
300+ expect (props.davResourcetype! .collection, isNull);
301+ expect (props.ncCreationTime, isNull);
302+ expect (props.ncAclCanManage, isNull);
303+ expect (props.ncAclEnabled, isNull);
304+ expect (props.ncAclList, isNull);
305+ expect (props.ncContainedFileCount, isNull);
306+ expect (props.ncContainedFolderCount, isNull);
307+ expect (props.ncDataFingerprint, isNull);
308+ expect (props.ncGroupFolderId, isNull);
309+ expect (props.ncHasPreview, isNull);
310+ expect (props.ncHidden, isNull);
311+ expect (props.ncInheritedAclList, isNull);
312+ expect (props.ncIsEncrypted, isNull);
313+ expect (props.ncIsMountRoot, isNull);
314+ expect (props.ncLock, isNull);
315+ expect (props.ncLockOwner, isNull);
316+ expect (props.ncLockOwnerDisplayname, isNull);
317+ expect (props.ncLockOwnerType, isNull);
318+ expect (props.ncLockTime, isNull);
319+ expect (props.ncLockTimeout, isNull);
320+ expect (props.ncLockToken, isNull);
321+ expect (props.ncMountType, isNull);
322+ expect (props.ncNote, isNull);
323+ expect (props.ncReminderDueDate, isNull);
324+ expect (props.ncRichWorkspace, isNull);
325+ expect (props.ncRichWorkspaceFile, isNull);
326+ expect (props.ncShareAttributes, isNull);
327+ expect (props.ncSharees, isNull);
328+ expect (props.ncUploadTime, isNull);
329+ expect (props.ncVersionAuthor, isNull);
330+ expect (props.ncVersionLabel, isNull);
331+ expect (props.ncMetadataBlurhash, isNull);
332+ expect (props.ocChecksums, isNull);
333+ expect (props.ocCommentsCount, isNull);
334+ expect (props.ocCommentsHref, isNull);
335+ expect (props.ocCommentsUnread, isNull);
336+ expect (props.ocDownloadURL, isNull);
337+ expect (props.ocFavorite, isNull);
338+ expect (props.ocFileid, isNull);
339+ expect (props.ocId, isNull);
340+ expect (props.ocOwnerDisplayName, isNull);
341+ expect (props.ocOwnerId, isNull);
342+ expect (props.ocPermissions, isNull);
343+ expect (props.ocShareTypes, isNull);
344+ expect (props.ocSize, isNull);
345+ expect (props.ocTags, isNull);
346+ expect (props.ocmSharePermissions, isNull);
347+ expect (props.ocsSharePermissions, isNull);
348+
349+ closeFixture ();
350+ expect (
351+ response.toXmlElement (namespaces: namespaces),
352+ containsAllAvailableProps (tester, PathUri .parse ('test/test.png' )),
353+ );
287354 });
288355
289356 test ('Get directory props' , () async {
290357 await tester.client.webdav.mkcol (PathUri .parse ('test/dir-props' ));
291358 final file = File ('test/files/test.png' );
292359 await tester.client.webdav.putFile (file, file.statSync (), PathUri .parse ('test/dir-props/test.png' ));
293360
294- final response = await tester.client.webdav.propfind (
361+ var response = await tester.client.webdav.propfind (
295362 PathUri .parse ('test/dir-props' ),
296363 prop: const WebDavPropWithoutValues .fromBools (
297364 davCreationdate: true ,
@@ -356,7 +423,7 @@ void main() {
356423 depth: WebDavDepth .zero,
357424 );
358425
359- final props = response.responses.first.propstats.first.prop;
426+ var props = response.responses.first.propstats.first.prop;
360427 expect (props.davCreationdate! .isBefore (DateTime .timestamp ()), isTrue);
361428 expect (props.davDisplayname, 'dir-props' );
362429 expect (props.davGetcontentlanguage, isNull);
@@ -414,6 +481,73 @@ void main() {
414481 expect (props.ocTags! .tags, isNull);
415482 expect (json.decode (props.ocmSharePermissions! ), ['share' , 'read' , 'write' ]);
416483 expect (props.ocsSharePermissions, 31 );
484+
485+ response = await tester.client.webdav.propfind (PathUri .parse ('test/dir-props' ));
486+
487+ props = response.responses.first.propstats.first.prop;
488+ expect (props.davCreationdate, isNull);
489+ expect (props.davDisplayname, isNull);
490+ expect (props.davGetcontentlanguage, isNull);
491+ expect (props.davGetcontentlength, isNull);
492+ expect (props.davGetcontenttype, isNull);
493+ expect (props.davGetetag, isNotEmpty);
494+ expect (props.davGetlastmodified! .isBefore (DateTime .timestamp ()), isTrue);
495+ expect (props.davQuotaAvailableBytes, - 3 );
496+ expect (props.davQuotaUsedBytes, 8650 );
497+ expect (props.davResourcetype! .collection, < dynamic > []);
498+ expect (props.ncCreationTime, isNull);
499+ expect (props.ncAclCanManage, isNull);
500+ expect (props.ncAclEnabled, isNull);
501+ expect (props.ncAclList, isNull);
502+ expect (props.ncContainedFileCount, isNull);
503+ expect (props.ncContainedFolderCount, isNull);
504+ expect (props.ncDataFingerprint, isNull);
505+ expect (props.ncGroupFolderId, isNull);
506+ expect (props.ncHasPreview, isNull);
507+ expect (props.ncHidden, isNull);
508+ expect (props.ncInheritedAclList, isNull);
509+ expect (props.ncIsEncrypted, isNull);
510+ expect (props.ncIsMountRoot, isNull);
511+ expect (props.ncLock, isNull);
512+ expect (props.ncLockOwner, isNull);
513+ expect (props.ncLockOwnerDisplayname, isNull);
514+ expect (props.ncLockOwnerType, isNull);
515+ expect (props.ncLockTime, isNull);
516+ expect (props.ncLockTimeout, isNull);
517+ expect (props.ncLockToken, isNull);
518+ expect (props.ncMountType, isNull);
519+ expect (props.ncNote, isNull);
520+ expect (props.ncReminderDueDate, isNull);
521+ expect (props.ncRichWorkspace, isNull);
522+ expect (props.ncRichWorkspaceFile, isNull);
523+ expect (props.ncShareAttributes, isNull);
524+ expect (props.ncSharees, isNull);
525+ expect (props.ncUploadTime, isNull);
526+ expect (props.ncVersionAuthor, isNull);
527+ expect (props.ncVersionLabel, isNull);
528+ expect (props.ncMetadataBlurhash, isNull);
529+ expect (props.ocChecksums, isNull);
530+ expect (props.ocCommentsCount, isNull);
531+ expect (props.ocCommentsHref, isNull);
532+ expect (props.ocCommentsUnread, isNull);
533+ expect (props.ocDownloadURL, isNull);
534+ expect (props.ocFavorite, isNull);
535+ expect (props.ocFileid, isNull);
536+ expect (props.ocId, isNull);
537+ expect (props.ocOwnerDisplayName, isNull);
538+ expect (props.ocOwnerId, isNull);
539+ expect (props.ocPermissions, isNull);
540+ expect (props.ocShareTypes, isNull);
541+ expect (props.ocSize, isNull);
542+ expect (props.ocTags, isNull);
543+ expect (props.ocmSharePermissions, isNull);
544+ expect (props.ocsSharePermissions, isNull);
545+
546+ closeFixture ();
547+ expect (
548+ response.toXmlElement (namespaces: namespaces),
549+ containsAllAvailableProps (tester, PathUri .parse ('test/dir-props' )),
550+ );
417551 });
418552
419553 test ('Create share' , () async {
0 commit comments