Skip to content

Commit

Permalink
Responds to backwards incompatible change in matlab-proxy v0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishan Sharma authored and Prabhakar Kumar committed May 8, 2024
1 parent 42d164d commit 1fe2f34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ classifiers = [
dependencies = [
"jupyter-server-proxy",
"simpervisor>=1.0.0",
"matlab-proxy>=0.10.0",
"matlab-proxy>=0.16.0",
"psutil",
"requests",
"ipykernel"
Expand Down
5 changes: 3 additions & 2 deletions src/jupyter_matlab_proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 The MathWorks, Inc.
# Copyright 2020-2024 The MathWorks, Inc.

import os
from pathlib import Path
Expand Down Expand Up @@ -77,6 +77,7 @@ def setup_matlab():
"""

import matlab_proxy
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
from matlab_proxy.util.mwi import logger as mwi_logger

logger = mwi_logger.get(init=True)
Expand Down Expand Up @@ -104,7 +105,7 @@ def setup_matlab():
# We are using token_hash instead of raw token for better security.
if _mwi_auth_token:
jsp_config["request_headers_override"] = {
"mwi_auth_token": _mwi_auth_token.get("token_hash")
MWI_AUTH_TOKEN_NAME_FOR_HTTP: _mwi_auth_token.get("token_hash")
}

return jsp_config
12 changes: 7 additions & 5 deletions tests/unit/test_jupyter_server_proxy.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2020-2023 The MathWorks, Inc.
# Copyright 2020-2024 The MathWorks, Inc.

import inspect
import os
from pathlib import Path

import matlab_proxy
from matlab_proxy.util.mwi import environment_variables as mwi_env

import jupyter_matlab_proxy
import matlab_proxy
from jupyter_matlab_proxy.jupyter_config import config
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
from matlab_proxy.util.mwi import environment_variables as mwi_env


def test_get_auth_token():
Expand Down Expand Up @@ -79,7 +79,9 @@ def test_setup_matlab():
"icon_path": icon_path,
},
"request_headers_override": {
"mwi_auth_token": jupyter_matlab_proxy._mwi_auth_token.get("token_hash"),
MWI_AUTH_TOKEN_NAME_FOR_HTTP: jupyter_matlab_proxy._mwi_auth_token.get(
"token_hash"
),
},
}

Expand Down

0 comments on commit 1fe2f34

Please sign in to comment.