Browse Source

fix tests with missing kdbx context.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
88829d27d4
  1. 2
      lib/src/kdbx_dao.dart
  2. 2
      lib/src/kdbx_entry.dart
  3. 2
      lib/src/kdbx_format.dart
  4. 6
      lib/src/kdbx_group.dart
  5. 5
      lib/src/kdbx_object.dart

2
lib/src/kdbx_dao.dart

@ -10,7 +10,7 @@ extension KdbxDao on KdbxFile {
@required String name, @required String name,
}) { }) {
assert(parent != null, name != null); assert(parent != null, name != null);
final newGroup = KdbxGroup.create(parent: parent, name: name); final newGroup = KdbxGroup.create(ctx: ctx, parent: parent, name: name);
parent.addGroup(newGroup); parent.addGroup(newGroup);
return newGroup; return newGroup;
} }

2
lib/src/kdbx_entry.dart

@ -36,7 +36,7 @@ class KdbxEntry extends KdbxObject {
KdbxEntry.create(KdbxFile file, KdbxGroup parent) KdbxEntry.create(KdbxFile file, KdbxGroup parent)
: isHistoryEntry = false, : isHistoryEntry = false,
history = [], history = [],
super.create(file, 'Entry', parent) { super.create(file.ctx, file, 'Entry', parent) {
icon.set(KdbxIcon.Key); icon.set(KdbxIcon.Key);
} }

2
lib/src/kdbx_format.dart

@ -305,7 +305,7 @@ class KdbxFormat {
ctx: ctx, ctx: ctx,
generator: generator, generator: generator,
); );
final rootGroup = KdbxGroup.create(parent: null, name: name); final rootGroup = KdbxGroup.create(ctx: ctx, parent: null, name: name);
final body = KdbxBody.create(meta, rootGroup); final body = KdbxBody.create(meta, rootGroup);
return KdbxFile( return KdbxFile(
ctx, ctx,

6
lib/src/kdbx_group.dart

@ -8,8 +8,12 @@ import 'package:xml/xml.dart';
import 'kdbx_object.dart'; import 'kdbx_object.dart';
class KdbxGroup extends KdbxObject { class KdbxGroup extends KdbxObject {
KdbxGroup.create({@required KdbxGroup parent, @required String name}) KdbxGroup.create(
{@required KdbxReadWriteContext ctx,
@required KdbxGroup parent,
@required String name})
: super.create( : super.create(
ctx,
parent?.file, parent?.file,
'Group', 'Group',
parent, parent,

5
lib/src/kdbx_object.dart

@ -71,8 +71,9 @@ abstract class KdbxNode with Changeable<KdbxNode> {
} }
abstract class KdbxObject extends KdbxNode { abstract class KdbxObject extends KdbxNode {
KdbxObject.create(this.file, String nodeName, KdbxGroup parent) KdbxObject.create(
: times = KdbxTimes.create(file.ctx), KdbxReadWriteContext ctx, this.file, String nodeName, KdbxGroup parent)
: times = KdbxTimes.create(ctx),
_parent = parent, _parent = parent,
super.create(nodeName) { super.create(nodeName) {
_uuid.set(KdbxUuid.random()); _uuid.set(KdbxUuid.random());

Loading…
Cancel
Save