Browse Source

nextcloud: Add missing coverage ignores for WebDAV

pull/392/head
jld3103 1 year ago
parent
commit
1ab7c70151
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 1
      packages/nextcloud/bin/generate_props.dart
  2. 8
      packages/nextcloud/lib/src/webdav/client.dart
  3. 1
      packages/nextcloud/lib/src/webdav/props.dart
  4. 10
      packages/nextcloud/lib/src/webdav/webdav.dart

1
packages/nextcloud/bin/generate_props.dart

@ -22,6 +22,7 @@ void main() {
File('lib/src/webdav/props.dart').writeAsStringSync( File('lib/src/webdav/props.dart').writeAsStringSync(
[ [
'// ignore_for_file: public_member_api_docs', '// ignore_for_file: public_member_api_docs',
'// coverage:ignore-file',
"import 'package:nextcloud/src/webdav/webdav.dart';", "import 'package:nextcloud/src/webdav/webdav.dart';",
"import 'package:xml/xml.dart';", "import 'package:xml/xml.dart';",
"import 'package:xml_annotation/xml_annotation.dart' as annotation;", "import 'package:xml_annotation/xml_annotation.dart' as annotation;",

8
packages/nextcloud/lib/src/webdav/client.dart

@ -65,7 +65,7 @@ class WebDavClient {
part = part.substring(1); part = part.substring(1);
} }
while (part.endsWith('/')) { while (part.endsWith('/')) {
part = part.substring(0, part.length - 1); part = part.substring(0, part.length - 1); // coverage:ignore-line
} }
return part; return part;
}) })
@ -116,7 +116,7 @@ class WebDavClient {
return null; return null;
} }
if (remotePath.trim().startsWith('/')) { if (remotePath.trim().startsWith('/')) {
dirs[0] = '/${dirs[0]}'; dirs[0] = '/${dirs[0]}'; // coverage:ignore-line
} }
final prevPath = StringBuffer(); final prevPath = StringBuffer();
late HttpClientResponse response; late HttpClientResponse response;
@ -245,11 +245,13 @@ class WebDavClient {
}, },
); );
if (response.statusCode == 301) { if (response.statusCode == 301) {
// coverage:ignore-start
return ls( return ls(
response.headers['location']!.first, response.headers['location']!.first,
prop: prop, prop: prop,
depth: depth, depth: depth,
); );
// coverage:ignore-end
} }
return _parseResponse(response); return _parseResponse(response);
} }
@ -272,7 +274,7 @@ class WebDavClient {
utf8.encode( utf8.encode(
WebDavOcFilterFiles( WebDavOcFilterFiles(
filterRules: filterRules, filterRules: filterRules,
prop: prop ?? WebDavPropfindProp(), prop: prop ?? WebDavPropfindProp(), // coverage:ignore-line
).toXmlElement(namespaces: namespaces).toXmlString(), ).toXmlElement(namespaces: namespaces).toXmlString(),
), ),
), ),

1
packages/nextcloud/lib/src/webdav/props.dart

@ -1,4 +1,5 @@
// ignore_for_file: public_member_api_docs // ignore_for_file: public_member_api_docs
// coverage:ignore-file
import 'package:nextcloud/src/webdav/webdav.dart'; import 'package:nextcloud/src/webdav/webdav.dart';
import 'package:xml/xml.dart'; import 'package:xml/xml.dart';
import 'package:xml_annotation/xml_annotation.dart' as annotation; import 'package:xml_annotation/xml_annotation.dart' as annotation;

10
packages/nextcloud/lib/src/webdav/webdav.dart

@ -1,4 +1,5 @@
// ignore_for_file: public_member_api_docs // ignore_for_file: public_member_api_docs
// coverage:ignore-file
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:nextcloud/src/webdav/props.dart'; import 'package:nextcloud/src/webdav/props.dart';
@ -78,9 +79,6 @@ class WebDavPropertyupdate with _$WebDavPropertyupdateXmlSerializableMixin {
required this.set, required this.set,
}); });
factory WebDavPropertyupdate.fromXmlElement(final XmlElement element) =>
_$WebDavPropertyupdateFromXmlElement(element);
@annotation.XmlElement(name: 'set', namespace: namespaceDav) @annotation.XmlElement(name: 'set', namespace: namespaceDav)
final WebDavSet set; final WebDavSet set;
} }
@ -95,7 +93,7 @@ class WebDavSet with _$WebDavSetXmlSerializableMixin {
factory WebDavSet.fromXmlElement(final XmlElement element) => _$WebDavSetFromXmlElement(element); factory WebDavSet.fromXmlElement(final XmlElement element) => _$WebDavSetFromXmlElement(element);
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) @annotation.XmlElement(name: 'prop', namespace: namespaceDav)
final WebDavProp prop; final WebDavProp prop; // coverage:ignore-line
} }
@annotation.XmlSerializable(createMixin: true) @annotation.XmlSerializable(createMixin: true)
@ -105,8 +103,6 @@ class WebDavPropfind with _$WebDavPropfindXmlSerializableMixin {
required this.prop, required this.prop,
}); });
factory WebDavPropfind.fromXmlElement(final XmlElement element) => _$WebDavPropfindFromXmlElement(element);
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) @annotation.XmlElement(name: 'prop', namespace: namespaceDav)
final WebDavPropfindProp prop; final WebDavPropfindProp prop;
} }
@ -119,8 +115,6 @@ class WebDavOcFilterFiles with _$WebDavOcFilterFilesXmlSerializableMixin {
required this.prop, required this.prop,
}); });
factory WebDavOcFilterFiles.fromXmlElement(final XmlElement element) => _$WebDavOcFilterFilesFromXmlElement(element);
@annotation.XmlElement(name: 'filter-rules', namespace: namespaceOwncloud) @annotation.XmlElement(name: 'filter-rules', namespace: namespaceOwncloud)
final WebDavOcFilterRules filterRules; final WebDavOcFilterRules filterRules;

Loading…
Cancel
Save