Skip to content

Commit

Permalink
test: add test for parsing of security field
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 22, 2022
1 parent bce9342 commit be445ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/consumed_thing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ void main() {

final parsedTd = ThingDescription(thingDescriptionJson);

final security = parsedTd.security;
expect(security, ["nosec_sc"]);

expect(parsedTd.title, "Test Thing");
expect(parsedTd.titles, {"en": "Test Thing"});
expect(parsedTd.description, "A Test Thing used for Testing.");
Expand Down
12 changes: 11 additions & 1 deletion test/dart_wot_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ void main() {
"sizes": "42",
"test": "test"
}
]
],
"securityDefinitions": {
"nosec_sc": {
"scheme": "nosec"
}
},
"security": ["nosec_sc"]
}
''';
final parsedTd = ThingDescription(thingDescriptionJson);
Expand All @@ -64,6 +70,10 @@ void main() {
expect(secondContextEntry.key, "@language");
expect(secondContextEntry.value, "de");

expect(parsedTd.security, ["nosec_sc"]);
final securityDefinition = parsedTd.securityDefinitions["nosec_sc"]!;
expect(securityDefinition.scheme, "nosec");

final parsedLink = parsedTd.links[0];
expect(parsedLink.href, Uri.parse("https://example.org"));
expect(parsedLink.rel, "test");
Expand Down

0 comments on commit be445ff

Please sign in to comment.