@@ -46,16 +46,18 @@ void main() {
46
46
expect (customServer2.scheme, 'https' );
47
47
});
48
48
49
- test ('HTTP Security Schemes' , () async {
50
- const username = 'username' ;
51
- const password = 'password' ;
52
- const token = 'thisIsTheMostAwesomeTokenEver!' ;
53
-
54
- // TODO(JKRhb): Does not have an effect in the TD yet (and is negotiated
55
- // automatically by http_auth instead)
56
- const qop = 'auth-int' ;
57
-
58
- const thingDescriptionJson = '''
49
+ test (
50
+ 'HTTP Security Schemes' ,
51
+ () async {
52
+ const username = 'username' ;
53
+ const password = 'password' ;
54
+ const token = 'thisIsTheMostAwesomeTokenEver!' ;
55
+
56
+ // TODO(JKRhb): Does not have an effect in the TD yet (and is negotiated
57
+ // automatically by http_auth instead)
58
+ const qop = 'auth-int' ;
59
+
60
+ const thingDescriptionJson = '''
59
61
{
60
62
"@context": ["http://www.w3.org/ns/td"],
61
63
"title": "Test Thing",
@@ -101,46 +103,49 @@ void main() {
101
103
}
102
104
''' ;
103
105
104
- final parsedTd = ThingDescription (thingDescriptionJson);
105
-
106
- final Map <String , BasicCredentials > basicCredentialsStore = {
107
- 'httpbin.org' : BasicCredentials (username, password),
108
- };
109
-
110
- final Map <String , DigestCredentials > digestCredentialsStore = {
111
- 'httpbin.org' : DigestCredentials (username, password),
112
- };
113
-
114
- final Map <String , BearerCredentials > bearerCredentialsStore = {
115
- 'httpbin.org' : BearerCredentials (token),
116
- };
106
+ final parsedTd = ThingDescription (thingDescriptionJson);
117
107
118
- final clientSecurityProvider = ClientSecurityProvider (
119
- basicCredentialsCallback: (uri, form, [invalidCredentials]) async {
120
- return basicCredentialsStore[uri.host];
121
- },
122
- digestCredentialsCallback: (uri, form, [invalidCredentials]) async =>
123
- digestCredentialsStore[uri.host],
124
- bearerCredentialsCallback: (uri, form, [invalidCredentials]) async =>
125
- bearerCredentialsStore[uri.host],
126
- );
127
-
128
- final servient = Servient (clientSecurityProvider: clientSecurityProvider)
129
- ..addClientFactory (HttpClientFactory ());
130
- final wot = await servient.start ();
108
+ final Map <String , BasicCredentials > basicCredentialsStore = {
109
+ 'httpbin.org' : BasicCredentials (username, password),
110
+ };
131
111
132
- final consumedThing = await wot.consume (parsedTd);
133
- final result = await consumedThing.readProperty ('status' );
134
- final value = await result.value ();
135
- expect (value, {'authenticated' : true , 'user' : username});
112
+ final Map <String , DigestCredentials > digestCredentialsStore = {
113
+ 'httpbin.org' : DigestCredentials (username, password),
114
+ };
136
115
137
- // final result2 = await consumedThing.readProperty('status2');
138
- // final value2 = await result2.value();
139
- // expect(value2, {'authenticated': true, 'user': username}) ;
116
+ final Map < String , BearerCredentials > bearerCredentialsStore = {
117
+ 'httpbin.org' : BearerCredentials (token),
118
+ } ;
140
119
141
- final result3 = await consumedThing.readProperty ('status3' );
142
- final value3 = await result3.value ();
143
- expect (value3, {'authenticated' : true , 'token' : token});
144
- });
120
+ final clientSecurityProvider = ClientSecurityProvider (
121
+ basicCredentialsCallback: (uri, form, [invalidCredentials]) async {
122
+ return basicCredentialsStore[uri.host];
123
+ },
124
+ digestCredentialsCallback: (uri, form, [invalidCredentials]) async =>
125
+ digestCredentialsStore[uri.host],
126
+ bearerCredentialsCallback: (uri, form, [invalidCredentials]) async =>
127
+ bearerCredentialsStore[uri.host],
128
+ );
129
+
130
+ final servient =
131
+ Servient (clientSecurityProvider: clientSecurityProvider)
132
+ ..addClientFactory (HttpClientFactory ());
133
+ final wot = await servient.start ();
134
+
135
+ final consumedThing = await wot.consume (parsedTd);
136
+ final result = await consumedThing.readProperty ('status' );
137
+ final value = await result.value ();
138
+ expect (value, {'authenticated' : true , 'user' : username});
139
+
140
+ // final result2 = await consumedThing.readProperty('status2');
141
+ // final value2 = await result2.value();
142
+ // expect(value2, {'authenticated': true, 'user': username});
143
+
144
+ final result3 = await consumedThing.readProperty ('status3' );
145
+ final value3 = await result3.value ();
146
+ expect (value3, {'authenticated' : true , 'token' : token});
147
+ },
148
+ skip: true ,
149
+ );
145
150
});
146
151
}
0 commit comments