Skip to content

Commit a96ed4c

Browse files
committed
TST: unit tests for sockets with authentication
1 parent c140d18 commit a96ed4c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bluesky_httpserver/tests/test_console_output.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ def __init__(self, api_key=API_KEY_FOR_TESTS, **kwargs):
353353

354354
def run(self):
355355
websocket_uri = f"ws://{SERVER_ADDRESS}:{SERVER_PORT}/api/console_output/ws"
356-
with connect(websocket_uri) as websocket:
356+
additional_headers = {"Authorization": f"ApiKey {self._api_key}"}
357+
with connect(websocket_uri, additional_headers=additional_headers) as websocket:
357358
while not self._exit:
358359
try:
359360
msg_json = websocket.recv(timeout=0.1, decode=False)

bluesky_httpserver/tests/test_system_info_socket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def __init__(self, *, endpoint, api_key=API_KEY_FOR_TESTS, **kwargs):
3535

3636
def run(self):
3737
websocket_uri = f"ws://{SERVER_ADDRESS}:{SERVER_PORT}/api{self._endpoint}"
38-
with connect(websocket_uri) as websocket:
38+
additional_headers = {"Authorization": f"ApiKey {self._api_key}"}
39+
with connect(websocket_uri, additional_headers=additional_headers) as websocket:
3940
while not self._exit:
4041
try:
4142
msg_json = websocket.recv(timeout=0.1, decode=False)

0 commit comments

Comments
 (0)