Fixed test cases

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-11 21:16:37 +08:00
parent 95e13b15c1
commit b3196f9d9c
2 changed files with 13 additions and 7 deletions

View file

@ -11,7 +11,7 @@
* Added merge_map and migrated to 2.0.0 (6/6 tests passed) * Added merge_map and migrated to 2.0.0 (6/6 tests passed)
* Added mock_request and migrated to 2.0.0 (0/0 tests) * Added mock_request and migrated to 2.0.0 (0/0 tests)
* Migrated angel_framework to 4.0.0 (146/150 tests passed) * Migrated angel_framework to 4.0.0 (146/150 tests passed)
* Migrated angel_auth to 4.0.0 (21/30 tests passed) * Migrated angel_auth to 4.0.0 (23/30 tests passed)
* Migrated angel_configuration to 4.0.0 (6/8 testspassed) * Migrated angel_configuration to 4.0.0 (6/8 testspassed)
* Migrated angel_validate to 4.0.0 (6/7 tests passed) * Migrated angel_validate to 4.0.0 (6/7 tests passed)
* Migrated json_god to 4.0.0 (13/13 tests passed) * Migrated json_god to 4.0.0 (13/13 tests passed)

View file

@ -43,9 +43,15 @@ class ExternalAuthOptions {
/// * `client_secret` /// * `client_secret`
/// * `redirect_uri` /// * `redirect_uri`
factory ExternalAuthOptions.fromMap(Map map) { factory ExternalAuthOptions.fromMap(Map map) {
var clientId = map['client_id'];
var clientSecret = map['client_secret'];
if (clientId == null || clientSecret == null) {
throw ArgumentError('Invalid clientId and/or clientSecret');
}
return ExternalAuthOptions( return ExternalAuthOptions(
clientId: map['client_id'] as String, clientId: clientId as String,
clientSecret: map['client_secret'] as String, clientSecret: clientSecret as String,
redirectUri: map['redirect_uri'], redirectUri: map['redirect_uri'],
scopes: map['scopes'] is Iterable scopes: map['scopes'] is Iterable
? ((map['scopes'] as Iterable).map((x) => x.toString())) ? ((map['scopes'] as Iterable).map((x) => x.toString()))
@ -66,13 +72,13 @@ class ExternalAuthOptions {
/// Creates a copy of this object, with the specified changes. /// Creates a copy of this object, with the specified changes.
ExternalAuthOptions copyWith( ExternalAuthOptions copyWith(
{String clientId = '', {String? clientId,
String clientSecret = '', String? clientSecret,
redirectUri, redirectUri,
Iterable<String> scopes = const []}) { Iterable<String> scopes = const []}) {
return ExternalAuthOptions( return ExternalAuthOptions(
clientId: clientId, clientId: clientId ?? this.clientId,
clientSecret: clientSecret, clientSecret: clientSecret ?? this.clientSecret,
redirectUri: redirectUri ?? this.redirectUri, redirectUri: redirectUri ?? this.redirectUri,
scopes: (scopes).followedBy(this.scopes), scopes: (scopes).followedBy(this.scopes),
); );