Files
rustdesk/flutter/test/uri_login_method_test.dart
T
21pages 956031d109 feat: add connections without sending passwords
Add Without password actions and pass the selection through desktop,
mobile and Web sessions. Omit the password when constructing LoginRequest,
preserve saved credentials, and reuse the existing approval and OS login
dialogs. Keep protocol and controlled-side authentication changes separate.
2026-10-31 12:08:07 +08:00

47 lines
1.4 KiB
Dart

import 'package:flutter_hbb/common.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('without-password links preserve their connection type', () {
for (final type in [
'connect',
'play',
'file-transfer',
'view-camera',
'port-forward',
'rdp',
'terminal',
'terminal-admin',
]) {
expect(
urlLinkToCmdArgs(
Uri.parse('rustdesk://$type/123456789?without-password=true')),
['--$type', '123456789', '--without-password'],
);
}
expect(
urlLinkToCmdArgs(Uri.parse('rustdesk://123456789?without-password=true')),
['--connect', '123456789', '--without-password'],
);
});
test('omitted and empty passwords retain automatic login', () {
expect(urlLinkToCmdArgs(Uri.parse('rustdesk://123456789')),
['--connect', '123456789']);
for (final query in ['password=', 'password=&without-password=false']) {
expect(urlLinkToCmdArgs(Uri.parse('rustdesk://123456789?$query')),
['--connect', '123456789', '--password', '']);
}
});
test('without-password ignores an explicit password in either order', () {
for (final query in [
'password=provided&without-password=true',
'without-password=true&password=provided',
]) {
expect(urlLinkToCmdArgs(Uri.parse('rustdesk://123456789?$query')),
['--connect', '123456789', '--without-password']);
}
});
}