55import os
66
77from frost_sta_client .service .sensorthingsservice import SensorThingsService
8+ from frost_sta_client .service .auth_handler import AuthHandler
89
910@pytest .fixture (scope = 'session' )
1011def frost_server ():
@@ -15,7 +16,7 @@ def frost_server():
1516 # Start FROST-Server using Podman
1617 subprocess .run (['podman' , 'compose' , '-f' , 'frost_server/docker-compose.yaml' , 'up' , '-d' ])
1718 # Wait for server to start
18- url = 'http://localhost:8080/FROST-Server/v1.1 '
19+ url = 'http://localhost:8080/FROST-Server'
1920 for _ in range (30 ):
2021 try :
2122 response = requests .get (url )
@@ -25,10 +26,22 @@ def frost_server():
2526 time .sleep (1 )
2627 else :
2728 raise RuntimeError ('FROST-Server failed to start' )
29+ vrl = 'http://localhost:8080/FROST-Server/v1.1'
30+ auth_handler = AuthHandler (
31+ username = "read" ,
32+ password = "read"
33+ )
34+ response = requests .get (vrl , auth = auth_handler .add_auth_header ())
35+ if response .status_code == 401 :
36+ raise RuntimeError ('Failed to authorize at FROST-Server' )
2837 yield
2938 subprocess .run (['podman' , 'compose' , '-f' , 'frost_server/docker-compose.yaml' , 'down' ])
3039
3140@pytest .fixture
3241def sensorthings_service (frost_server ):
3342 url = 'http://localhost:8080/FROST-Server/v1.1'
34- return SensorThingsService (url )
43+ auth_handler = AuthHandler (
44+ username = "admin" ,
45+ password = "admin"
46+ )
47+ return SensorThingsService (url , auth_handler = auth_handler )
0 commit comments