Skip to content

Commit

Permalink
test: add test cases for ComboSecurityScheme
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed May 13, 2023
1 parent f0705d0 commit 97637e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/core/consumed_thing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:dart_wot/dart_wot.dart';
import 'package:dart_wot/src/definitions/security/apikey_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/basic_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/bearer_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/combo_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/digest_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/no_security_scheme.dart';
import 'package:dart_wot/src/definitions/security/oauth2_security_scheme.dart';
Expand Down Expand Up @@ -79,6 +80,14 @@ void main() {
"refresh": "http://example.org",
"scopes": "test",
"flow": "client"
},
"combo_sc1": {
"scheme": "combo",
"allOf": ["digest_sc", "apikey_sc"]
},
"combo_sc2": {
"scheme": "combo",
"oneOf": ["oauth2_sc", "bearer_sc"]
}
},
"security": "nosec_sc",
Expand Down Expand Up @@ -210,6 +219,22 @@ void main() {
expect(oauth2Sc.token, 'http://example.org');
expect(oauth2Sc.scopes, ['test']);
expect(oauth2Sc.flow, 'client');

final comboSc1 = parsedTd.securityDefinitions['combo_sc1'];
expect(comboSc1 is ComboSecurityScheme, true);
expect(
(comboSc1 as ComboSecurityScheme?)!.allOf,
['digest_sc', 'apikey_sc'],
);
expect(comboSc1!.oneOf, null);

final comboSc2 = parsedTd.securityDefinitions['combo_sc2'];
expect(comboSc2 is ComboSecurityScheme, true);
expect(
(comboSc2 as ComboSecurityScheme?)!.oneOf,
['oauth2_sc', 'bearer_sc'],
);
expect(comboSc2!.allOf, null);
});
});

Expand Down

0 comments on commit 97637e0

Please sign in to comment.