Skip to content

Commit

Permalink
Merge pull request #587 from atsign-foundation/add_force_flag
Browse files Browse the repository at this point in the history
fix: Add force flag to enroll_verb_builder.dart
  • Loading branch information
gkc authored May 28, 2024
2 parents e23e429 + f154581 commit 90ee76f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/at_commons/lib/src/verb/enroll_verb_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class EnrollVerbBuilder extends AbstractVerbBuilder {
String? encryptedDefaultSelfEncryptionKey;
String? encryptedAPKAMSymmetricKey;

/// Used to force revoke the enrollment request.
bool force = false;

/// Filters enrollment requests based on provided [EnrollmentStatus] criteria.
///
/// Accepts a list of enrollment statuses. Defaults to all EnrollmentStatuses
Expand All @@ -46,6 +49,9 @@ class EnrollVerbBuilder extends AbstractVerbBuilder {
var sb = StringBuffer();
sb.write('enroll:');
sb.write(getEnrollOperation(operation));
if (force) {
sb.write(':force');
}

EnrollParams enrollParams = EnrollParams()
..enrollmentId = enrollmentId
Expand Down
9 changes: 9 additions & 0 deletions packages/at_commons/test/enroll_verb_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ void main() {
expect(command, 'enroll:revoke:{"enrollmentId":"123"}\n');
});

test('A test to verify enroll force revoke operation', () {
var enrollVerbBuilder = EnrollVerbBuilder()
..operation = EnrollOperationEnum.revoke
..enrollmentId = '123'
..force = true;
var command = enrollVerbBuilder.buildCommand();
expect(command, 'enroll:revoke:force:{"enrollmentId":"123"}\n');
});

test('A test to verify to override enroll list status', () {
var enrollVerbBuilder = EnrollVerbBuilder()
..operation = EnrollOperationEnum.list
Expand Down

0 comments on commit 90ee76f

Please sign in to comment.