Skip to content

Commit

Permalink
test: update functional tests with new code modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
srieteja committed Oct 9, 2023
1 parent a449681 commit 3e27c1b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/at_functional_test/test/enroll_verb_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void main() {
var enrollResponse = await read();
enrollResponse = enrollResponse.replaceFirst('error:', '');
expect(enrollResponse,
'AT0026:Invalid otp. Cannot process enroll request\n');
'AT0022-Exception: Invalid OTP. Cannot process enroll request\n');
});

test('enroll request on unauthenticated connection invalid otp', () async {
Expand All @@ -158,7 +158,7 @@ void main() {
var enrollResponse = await read();
enrollResponse = enrollResponse.replaceFirst('data:', '');
expect(enrollResponse,
'error:AT0026:Invalid otp. Cannot process enroll request\n');
'error:AT0022-Exception: Invalid OTP. Cannot process enroll request\n');
});

// Purpose of the tests
Expand Down Expand Up @@ -632,13 +632,15 @@ void main() {
String enrollmentId = jsonDecode(
enrollmentResponse.replaceAll('data:', ''))['enrollmentId'];

// perform revoke operation with socket2 which is un-authenticated
socketConnection2 =
await secure_socket_connection(firstAtsignServer, firstAtsignPort);
socket_listener(socketConnection2!);
String revokeEnrollmentCommand =
'enroll:revoke:enrollmentid:$enrollmentId';
'enroll:revoke:{"enrollmentid":"$enrollmentId"}';
await socket_writer(socketConnection2!, revokeEnrollmentCommand);
var revokeEnrollmentResponse = await read();
print('enroll:revoke response $revokeEnrollmentResponse');
expect(revokeEnrollmentResponse.trim(),
'error:AT0401-Exception: Cannot revoke enrollment without authentication');
});
Expand Down Expand Up @@ -765,11 +767,12 @@ void main() {
isApkam: true, enrollmentId: enrollId);
await socket_writer(socketConnection1!,
'enroll:update:{"enrollmentId":"$enrollId","namespaces":{"buzz":"rw"}}');
await read();
print('enroll update response: ${await read()}');
// approve enrollment update request
await socket_writer(
socketConnection1!, 'enroll:approve:{"enrollmentId":"$enrollId"}');
var updateResponse = await read();
print('enroll approve response: $updateResponse');
updateResponse = updateResponse.replaceFirst('data:', '');
expect(jsonDecode(updateResponse)['status'], 'approved');
expect(jsonDecode(updateResponse)['enrollmentId'], enrollId);
Expand Down

0 comments on commit 3e27c1b

Please sign in to comment.