Skip to content

Commit

Permalink
Merge branch 'at_auth_new_package' of https://github.com/atsign-found…
Browse files Browse the repository at this point in the history
…ation/at_libraries into at_auth_new_package
  • Loading branch information
murali-shris committed Oct 12, 2023
2 parents 51e04af + 208bd66 commit 648509c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/at_auth/test/at_auth_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void main() {
..rootPort = 64
..enableEnrollment = true
..appName = 'wavi'
..authMode = PkamAuthMode.keysFile
..deviceName = 'iphone';

final response =
Expand All @@ -229,5 +230,30 @@ void main() {
expect(response.isSuccessful, true);
expect(response.enrollmentId, 'abc123');
});

test('Test onboard - enable enrollment set to false', () async {
when(() => mockAtLookUp.authenticate_cram(testCramSecret))
.thenAnswer((_) => Future.value(true));
when(() => mockAtLookUp.executeCommand(any()))
.thenAnswer((_) => Future.value('data:1'));
when(() => mockAtLookUp.executeVerb(any()))
.thenAnswer((_) => Future.value('data:2'));

when(() => mockAtLookUp.close()).thenAnswer((_) async => {});
when(() => mockPkamAuthenticator.authenticate()).thenAnswer(
(_) => Future.value(AtAuthResponse('@alice🛠')..isSuccessful = true));

final atOnboardingRequest = AtOnboardingRequest('@alice🛠')
..rootDomain = 'test.atsign.com'
..rootPort = 64
..enableEnrollment = false
..appName = 'wavi'
..deviceName = 'iphone';

final response =
await atAuth.onboard(atOnboardingRequest, testCramSecret);
expect(response.isSuccessful, true);
});

});
}

0 comments on commit 648509c

Please sign in to comment.