@@ -9,21 +9,28 @@ import ai.ancf.lmos.wot.security.BearerSecurityScheme
99import ai.ancf.lmos.wot.thing.schema.genericReadProperty
1010import ai.ancf.lmos.wot.thing.schema.genericWriteProperty
1111import kotlinx.coroutines.test.runTest
12+ import kotlin.test.BeforeTest
1213import kotlin.test.Test
1314
1415class TestWebThings {
1516
16- @Test
17- fun `Should control devices` () = runTest {
17+ private lateinit var wot: Wot
18+
19+ @BeforeTest
20+ fun setup () = runTest {
1821 val http = HttpProtocolClientFactory ()
1922 val https = HttpsProtocolClientFactory ()
20- val servient = Servient (clientFactories = listOf (http, https), credentialStore =
21- mapOf (" https://plugfest.webthings.io" to
22- BearerCredentials (" eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjE1OWM4MzhlLWYxZmItNGE3ZC1iZDY2LTBlNmI1ZDZjNWVhMCJ9.eyJyb2xlIjoidXNlcl90b2tlbiIsImlhdCI6MTczMjI5MjczNSwiaXNzIjoiaHR0cHM6Ly9wbHVnZmVzdC53ZWJ0aGluZ3MuaW8ifQ.CpQ5MLSygmCJFS6yz4Xdf0xyImwqBWvNfKNZPX9DNHjyjuq5wzq0mWurSu11wR-BwnZ2lnFcIId3ytfbo9hBwg" )
23- ))
24-
25- val wot = Wot .create(servient)
23+ val servient = Servient (
24+ clientFactories = listOf (http, https),
25+ credentialStore = mapOf (" https://plugfest.webthings.io" to
26+ BearerCredentials (" dummy" )
27+ )
28+ )
29+ wot = Wot .create(servient)
30+ }
2631
32+ @Test
33+ fun `Should control devices` () = runTest {
2734 val thingDescription = wot.requestThingDescription(" https://plugfest.webthings.io/things/virtual-things-2" ,
2835 BearerSecurityScheme ())
2936
@@ -34,7 +41,5 @@ class TestWebThings {
3441
3542 testThing.genericWriteProperty(" level" , 50 )
3643 testThing.genericWriteProperty(" on" , true )
37-
38-
3944 }
4045}
0 commit comments