matlab-proxy 0.15.0__py3-none-any.whl → 0.16.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of matlab-proxy might be problematic. Click here for more details.
- matlab_proxy/app.py +13 -7
- matlab_proxy/app_state.py +9 -6
- matlab_proxy/constants.py +1 -0
- matlab_proxy/gui/asset-manifest.json +3 -3
- matlab_proxy/gui/index.html +1 -1
- matlab_proxy/gui/static/js/{main.14aa7840.js → main.522d83ba.js} +3 -3
- matlab_proxy/gui/static/js/main.522d83ba.js.map +1 -0
- matlab_proxy/settings.py +7 -4
- matlab_proxy/util/__init__.py +8 -1
- matlab_proxy/util/mwi/token_auth.py +19 -5
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/METADATA +1 -1
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/RECORD +40 -20
- tests/integration/integration_tests_with_license/test_http_end_points.py +4 -4
- tests/integration/integration_tests_without_license/conftest.py +4 -3
- tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py +3 -0
- tests/unit/__init__.py +1 -0
- tests/unit/conftest.py +67 -0
- tests/unit/test_app.py +1113 -0
- tests/unit/test_app_state.py +586 -0
- tests/unit/test_constants.py +6 -0
- tests/unit/test_ddux.py +22 -0
- tests/unit/test_devel.py +246 -0
- tests/unit/test_non_dev_mode.py +169 -0
- tests/unit/test_settings.py +460 -0
- tests/unit/util/__init__.py +3 -0
- tests/unit/util/mwi/__init__.py +1 -0
- tests/unit/util/mwi/embedded_connector/__init__.py +1 -0
- tests/unit/util/mwi/embedded_connector/test_helpers.py +29 -0
- tests/unit/util/mwi/embedded_connector/test_request.py +64 -0
- tests/unit/util/mwi/test_custom_http_headers.py +281 -0
- tests/unit/util/mwi/test_logger.py +49 -0
- tests/unit/util/mwi/test_token_auth.py +303 -0
- tests/unit/util/mwi/test_validators.py +331 -0
- tests/unit/util/test_mw.py +550 -0
- tests/unit/util/test_util.py +135 -0
- matlab_proxy/gui/static/js/main.14aa7840.js.map +0 -1
- /matlab_proxy/gui/static/js/{main.14aa7840.js.LICENSE.txt → main.522d83ba.js.LICENSE.txt} +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/LICENSE.md +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/WHEEL +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/entry_points.txt +0 -0
- {matlab_proxy-0.15.0.dist-info → matlab_proxy-0.16.0.dist-info}/top_level.txt +0 -0
matlab_proxy/settings.py
CHANGED
|
@@ -17,6 +17,7 @@ from cryptography.x509.oid import NameOID
|
|
|
17
17
|
|
|
18
18
|
import matlab_proxy
|
|
19
19
|
from matlab_proxy import constants
|
|
20
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
20
21
|
from matlab_proxy.util import mwi, system
|
|
21
22
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
22
23
|
from matlab_proxy.util.mwi import token_auth
|
|
@@ -197,11 +198,12 @@ def get_dev_settings(config):
|
|
|
197
198
|
"mwi_logs_root_dir": get_mwi_logs_root_dir(dev=True),
|
|
198
199
|
"mw_context_tags": get_mw_context_tags(matlab_proxy.get_default_config_name()),
|
|
199
200
|
"mwi_server_url": None,
|
|
200
|
-
"mwi_is_token_auth_enabled": mwi_auth_token
|
|
201
|
+
"mwi_is_token_auth_enabled": mwi_auth_token is not None,
|
|
201
202
|
"mwi_auth_status": False,
|
|
202
203
|
"mwi_auth_token": mwi_auth_token,
|
|
203
204
|
"mwi_auth_token_hash": mwi_auth_token_hash,
|
|
204
|
-
"
|
|
205
|
+
"mwi_auth_token_name_for_http": MWI_AUTH_TOKEN_NAME_FOR_HTTP,
|
|
206
|
+
"mwi_auth_token_name_for_env": mwi_env.get_env_name_mwi_auth_token().lower(),
|
|
205
207
|
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
|
|
206
208
|
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
|
|
207
209
|
),
|
|
@@ -322,11 +324,12 @@ def get_server_settings(config_name):
|
|
|
322
324
|
"mw_context_tags": get_mw_context_tags(config_name),
|
|
323
325
|
# The url where the matlab-proxy server is accessible at
|
|
324
326
|
"mwi_server_url": None,
|
|
325
|
-
"mwi_is_token_auth_enabled": mwi_auth_token
|
|
327
|
+
"mwi_is_token_auth_enabled": mwi_auth_token is not None,
|
|
326
328
|
"mwi_auth_status": False,
|
|
327
329
|
"mwi_auth_token": mwi_auth_token,
|
|
328
330
|
"mwi_auth_token_hash": mwi_auth_token_hash,
|
|
329
|
-
"
|
|
331
|
+
"mwi_auth_token_name_for_http": MWI_AUTH_TOKEN_NAME_FOR_HTTP,
|
|
332
|
+
"mwi_auth_token_name_for_env": mwi_env.get_env_name_mwi_auth_token().lower(),
|
|
330
333
|
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
|
|
331
334
|
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
|
|
332
335
|
),
|
matlab_proxy/util/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import argparse
|
|
4
4
|
import os
|
|
5
5
|
import socket
|
|
6
|
+
import time
|
|
6
7
|
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
|
|
@@ -198,7 +199,9 @@ def get_child_processes(parent_process):
|
|
|
198
199
|
# to get hold child processes
|
|
199
200
|
parent_process_psutil = psutil.Process(parent_process.pid)
|
|
200
201
|
|
|
201
|
-
|
|
202
|
+
max_attempts = 10
|
|
203
|
+
child_processes = None
|
|
204
|
+
for _ in range(max_attempts):
|
|
202
205
|
try:
|
|
203
206
|
# Before checking for any child processes, ensure that the parent process is running
|
|
204
207
|
assert (
|
|
@@ -216,6 +219,10 @@ def get_child_processes(parent_process):
|
|
|
216
219
|
|
|
217
220
|
if child_processes:
|
|
218
221
|
break
|
|
222
|
+
time.sleep(0.1)
|
|
223
|
+
|
|
224
|
+
if not child_processes:
|
|
225
|
+
raise RuntimeError("No child processes found after multiple attempts.")
|
|
219
226
|
|
|
220
227
|
return child_processes
|
|
221
228
|
|
|
@@ -59,7 +59,7 @@ def generate_mwi_auth_token_and_hash():
|
|
|
59
59
|
def get_mwi_auth_token_access_str(app_settings):
|
|
60
60
|
"""Returns formatted string with mwi token for use with server URL"""
|
|
61
61
|
if app_settings["mwi_is_token_auth_enabled"]:
|
|
62
|
-
mwi_auth_token_name = app_settings["
|
|
62
|
+
mwi_auth_token_name = app_settings["mwi_auth_token_name_for_http"]
|
|
63
63
|
mwi_auth_token = app_settings["mwi_auth_token"]
|
|
64
64
|
return f"?{mwi_auth_token_name}={mwi_auth_token}"
|
|
65
65
|
|
|
@@ -134,7 +134,20 @@ async def _get_token_name(request):
|
|
|
134
134
|
str : token name
|
|
135
135
|
"""
|
|
136
136
|
app_settings = request.app["settings"]
|
|
137
|
-
return app_settings["
|
|
137
|
+
return app_settings["mwi_auth_token_name_for_env"]
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _get_token_name_for_http(request):
|
|
141
|
+
"""Gets the name of the token from settings.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
request (HTTPRequest) : Used to get to app settings
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
str : token name
|
|
148
|
+
"""
|
|
149
|
+
app_settings = request.app["settings"]
|
|
150
|
+
return app_settings["mwi_auth_token_name_for_http"]
|
|
138
151
|
|
|
139
152
|
|
|
140
153
|
async def _get_token(request):
|
|
@@ -238,11 +251,11 @@ async def _is_valid_token_in_url_query(request):
|
|
|
238
251
|
query_string = request.query_string
|
|
239
252
|
logger.debug(f"url query parameters found:{query_string}")
|
|
240
253
|
if query_string:
|
|
241
|
-
token_name =
|
|
254
|
+
token_name = _get_token_name_for_http(request)
|
|
242
255
|
parsed_token = parse_qs(request.query_string).get(token_name)
|
|
243
256
|
if parsed_token:
|
|
244
257
|
parsed_token = parsed_token[0]
|
|
245
|
-
logger.debug(
|
|
258
|
+
logger.debug("parsed_token from url query string.")
|
|
246
259
|
return await _is_valid_token(parsed_token, request)
|
|
247
260
|
|
|
248
261
|
logger.debug("Token not found in url query.")
|
|
@@ -262,8 +275,9 @@ async def _is_valid_token_in_headers(request):
|
|
|
262
275
|
"""
|
|
263
276
|
logger.debug("Checking for token in request headers...")
|
|
264
277
|
headers = request.headers
|
|
265
|
-
token_name =
|
|
278
|
+
token_name = _get_token_name_for_http(request)
|
|
266
279
|
if token_name in headers:
|
|
280
|
+
logger.debug(f"Token found in headers: {token_name}")
|
|
267
281
|
is_valid_token = await _is_valid_token(headers[token_name], request)
|
|
268
282
|
if is_valid_token:
|
|
269
283
|
await _store_token_hash_into_session(request)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
matlab_proxy/__init__.py,sha256=6cwi8buKCMtw9OeWaOYUHEoqwl5MyJ_s6GxgNuqPuNg,1673
|
|
2
|
-
matlab_proxy/app.py,sha256
|
|
3
|
-
matlab_proxy/app_state.py,sha256=
|
|
4
|
-
matlab_proxy/constants.py,sha256=
|
|
2
|
+
matlab_proxy/app.py,sha256=-QcfNOCyXAQu58Gq-bSU4iHtJrVglxgD0c-n6nTzumo,33819
|
|
3
|
+
matlab_proxy/app_state.py,sha256=tHZpv2pEk_zb55FKDvnIIcIg-S3i-r52h5WHot-wITI,55450
|
|
4
|
+
matlab_proxy/constants.py,sha256=gHL6bYgRDyzufMx1XF9tbtC9vsS_yQlfYPNommti8tA,972
|
|
5
5
|
matlab_proxy/default_configuration.py,sha256=DxQaHzAivzstiPl_nDfxs8SOyP9oaK9v3RP4LtroJl4,843
|
|
6
6
|
matlab_proxy/devel.py,sha256=nR6XPVBUEdQ-RZGtYvX1YHTp8gj9cuw5Hp8ahasMBc8,14310
|
|
7
|
-
matlab_proxy/settings.py,sha256=
|
|
7
|
+
matlab_proxy/settings.py,sha256=Q901JN7zwcySVOs7EQ69m4Ngishmo9ihFzqbPxXajh4,24915
|
|
8
8
|
matlab_proxy/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
matlab_proxy/gui/asset-manifest.json,sha256=
|
|
9
|
+
matlab_proxy/gui/asset-manifest.json,sha256=Y0bASwFy_ZO21iJjvOmN9Rf4pgvKRqpVMxVQ5g0eU2Q,3516
|
|
10
10
|
matlab_proxy/gui/favicon.ico,sha256=7w7Ki1uQP2Rgwc64dOV4-NrTu97I3WsZw8OvRSoY1A0,130876
|
|
11
|
-
matlab_proxy/gui/index.html,sha256=
|
|
11
|
+
matlab_proxy/gui/index.html,sha256=R6bC4lxj_0V0mmXr4Rqf9mHQoDWkNY0CpKBGNvxWaWs,637
|
|
12
12
|
matlab_proxy/gui/manifest.json,sha256=NwDbrALM5auYyj2bbEf4aGwAUDqNl1FzMFQpPiG2Ty4,286
|
|
13
13
|
matlab_proxy/gui/robots.txt,sha256=kNJLw79pisHhc3OVAimMzKcq3x9WT6sF9IS4xI0crdI,67
|
|
14
14
|
matlab_proxy/gui/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -16,9 +16,9 @@ matlab_proxy/gui/static/css/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
16
16
|
matlab_proxy/gui/static/css/main.47712126.css,sha256=OT5ccyC0a6fVg956C-8b6uDVbZZVgcpXbHjdO6v4ZBI,274313
|
|
17
17
|
matlab_proxy/gui/static/css/main.47712126.css.map,sha256=RdfmXfQvzvvh4XZuDWShm8CD8pA2Gb2K6MtMzrgJyKM,350495
|
|
18
18
|
matlab_proxy/gui/static/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
matlab_proxy/gui/static/js/main.
|
|
20
|
-
matlab_proxy/gui/static/js/main.
|
|
21
|
-
matlab_proxy/gui/static/js/main.
|
|
19
|
+
matlab_proxy/gui/static/js/main.522d83ba.js,sha256=6Mr6KC2dNysr7aA1VUObaA-2XZDPeZbA7FWl3W3GH68,294192
|
|
20
|
+
matlab_proxy/gui/static/js/main.522d83ba.js.LICENSE.txt,sha256=3cj3DrwM51esz1ogL9VVU1ZyXyXJ6u-Ec2CI9CCcI_A,1689
|
|
21
|
+
matlab_proxy/gui/static/js/main.522d83ba.js.map,sha256=dJifP1EbrR0Dli2vzs_uRFhJ10MG_6Zwaw2GtWWEkq0,937322
|
|
22
22
|
matlab_proxy/gui/static/media/MATLAB-env-blur.4fc94edbc82d3184e5cb.png,sha256=QpmQTLDvBu2-b7ev83Rvpt0Q72R6wdQGkuJMPPpjv7M,220290
|
|
23
23
|
matlab_proxy/gui/static/media/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
matlab_proxy/gui/static/media/arrow.0c2968b90bd9a64c8c3f.svg,sha256=XtmvDWzGZnwCZm08TKBnqt5hc1wphJnNupG0Fx_faAY,327
|
|
@@ -53,7 +53,7 @@ matlab_proxy/gui/static/media/trigger-error.3f1c4ef23ab8f3e60b0e.svg,sha256=3zzT
|
|
|
53
53
|
matlab_proxy/gui/static/media/trigger-ok.7b9c238be42f685c4fa7.svg,sha256=mD-7N9cc4ARdMBFcplnogJv6nA4Yh3jQuYbZDUi18LU,4997
|
|
54
54
|
matlab_proxy/icons/matlab.svg,sha256=xh5uYebQd8I-ISvenjU9A-PkClzW_lU9wvm3doXOFKM,13366
|
|
55
55
|
matlab_proxy/matlab/startup.m,sha256=YRtI8P2flDJSDcPxJ2008B2l1T9JpqiUbzhQxA0frbc,1558
|
|
56
|
-
matlab_proxy/util/__init__.py,sha256=
|
|
56
|
+
matlab_proxy/util/__init__.py,sha256=ikj07VxQdIThUWzWLOrdIsO-R1VtEhunB0mjrfnD5jE,8114
|
|
57
57
|
matlab_proxy/util/event_loop.py,sha256=Zqd282jlvPHHyc4kg8IjIzlzh9zLM_SAc5xjqUOrm04,1144
|
|
58
58
|
matlab_proxy/util/list_servers.py,sha256=M93coVZjyQCdIvCCxsNOU_XDWNjBSysOJ5tWXaTjP8Y,1369
|
|
59
59
|
matlab_proxy/util/mw.py,sha256=dLGSdfcTZiwKR1MMZA-39o-8na13IEPZOGBqcaHmKVI,11086
|
|
@@ -65,7 +65,7 @@ matlab_proxy/util/mwi/download.py,sha256=-GJj3yOsL4vF_9baqRXkgBI-vu_OwjZMQVkJXFS
|
|
|
65
65
|
matlab_proxy/util/mwi/environment_variables.py,sha256=bIz0QFWo0pgyvSeJ_kAobUCS17V05CSmFWm3zYIOIsA,7139
|
|
66
66
|
matlab_proxy/util/mwi/exceptions.py,sha256=93HrHbOq24KI4Md2el23XN01wIqVShEK29Pbt2V0Jr8,4628
|
|
67
67
|
matlab_proxy/util/mwi/logger.py,sha256=e7wTPclrtJ-aX5mPk_pUJMX7-1QD_snGBW1P2ks-ETE,3311
|
|
68
|
-
matlab_proxy/util/mwi/token_auth.py,sha256=
|
|
68
|
+
matlab_proxy/util/mwi/token_auth.py,sha256=UbIWqo7qADaZdijFvorLYsZbxzaB8TycGP8nk305ru0,9997
|
|
69
69
|
matlab_proxy/util/mwi/validators.py,sha256=BMMOD-0tdjGIALm1MmG4yXVRoD2ZUXkrJXLWP_D5FGo,11712
|
|
70
70
|
matlab_proxy/util/mwi/embedded_connector/__init__.py,sha256=SVSckEJ4zQQ2KkNPT_un8ndMAImcMOTrai7ShAbmFY4,114
|
|
71
71
|
matlab_proxy/util/mwi/embedded_connector/helpers.py,sha256=p6TedefbvhlZT64IMwFjrb0panWCXf-T3XPoztDbxM0,3391
|
|
@@ -73,18 +73,38 @@ matlab_proxy/util/mwi/embedded_connector/request.py,sha256=-6DL9K8JWjX5u5XVOEGaq
|
|
|
73
73
|
tests/integration/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
74
74
|
tests/integration/integration_tests_with_license/__init__.py,sha256=vVYZCur-QhmIGCxUmn-WZjIywtDQidaLDmlmrRHRlgY,37
|
|
75
75
|
tests/integration/integration_tests_with_license/conftest.py,sha256=sCaIXB8d4vf05C7JWSVA7g5gnPjbpRq3dftuBpWyp1s,1599
|
|
76
|
-
tests/integration/integration_tests_with_license/test_http_end_points.py,sha256=
|
|
76
|
+
tests/integration/integration_tests_with_license/test_http_end_points.py,sha256=SDJIoyo-hh2Ns9uWaDeO87N0jY3svhKOn29HFFyx_jM,7485
|
|
77
77
|
tests/integration/integration_tests_without_license/__init__.py,sha256=vVYZCur-QhmIGCxUmn-WZjIywtDQidaLDmlmrRHRlgY,37
|
|
78
|
-
tests/integration/integration_tests_without_license/conftest.py,sha256=
|
|
79
|
-
tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py,sha256=
|
|
78
|
+
tests/integration/integration_tests_without_license/conftest.py,sha256=n-oppKWxavyy1O0J6DywO3DnOHuYc7yUZRXm3Bt4szU,3526
|
|
79
|
+
tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py,sha256=tkdyhfZBpfJpbnEzjURyV-GE0p43YxOa9xooJf-JoM4,1653
|
|
80
80
|
tests/integration/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
81
81
|
tests/integration/utils/integration_tests_utils.py,sha256=IbJ9CedFHiz3k85FBY-8GwotTnjPF3jF4AHdKio7jqk,10321
|
|
82
82
|
tests/integration/utils/licensing.py,sha256=rEBjvMXO8R3mL6KnePu2lojmOsjD4GXl9frf9N0Wacs,4842
|
|
83
|
+
tests/unit/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
|
|
84
|
+
tests/unit/conftest.py,sha256=Hfxq3h8IZuLJkRMh5jdEFiq78CIAdKvm-6KryRDZ0FY,1918
|
|
85
|
+
tests/unit/test_app.py,sha256=8hR0pWEIWrXU2UTZLLug9spaadp5Hb33960RE3jy4mw,37300
|
|
86
|
+
tests/unit/test_app_state.py,sha256=wuEAYCXT262Ew01tRVP_SwRDa_M6MlzkkKuGTlcbGaY,18790
|
|
87
|
+
tests/unit/test_constants.py,sha256=ieDKc7bL8zWsd_D4dv2n8iftXr2h-bkS5p6zVan0BtQ,125
|
|
88
|
+
tests/unit/test_ddux.py,sha256=a2J2iM8j_nnfJVuMI38p5AjwrRdoMj3N88gFgS2I4hg,713
|
|
89
|
+
tests/unit/test_devel.py,sha256=A-1iVhSSwmywaW65QIRcUS2Fk7nJxceCcCm7CJtNdEc,7982
|
|
90
|
+
tests/unit/test_non_dev_mode.py,sha256=0v27y27SLOWvw6jf_GhLLNg-RMsZS_OyGAnqoQYPpSA,5515
|
|
91
|
+
tests/unit/test_settings.py,sha256=6KuYcOIqilR5RmaYxHw5mr_4CqDS3iMsouS-IrT9wGk,16644
|
|
92
|
+
tests/unit/util/__init__.py,sha256=GInSQBb2SoVD5LZfmSCQa9-UZJT_UP-jNfrojkgCybU,87
|
|
93
|
+
tests/unit/util/test_mw.py,sha256=YC4mjn6G6_XuHELt8uW9F6g2K0_fWtQl1R0kWFvWbAo,18565
|
|
94
|
+
tests/unit/util/test_util.py,sha256=jhZOgErpD6b3JeusLBOPVvu6iZ3_ttwlEVV8uKLUvrw,5060
|
|
95
|
+
tests/unit/util/mwi/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
96
|
+
tests/unit/util/mwi/test_custom_http_headers.py,sha256=UfrhclS0j6WhShtg1ki2oF1kK8JqRC29uevH4tuDqF4,11182
|
|
97
|
+
tests/unit/util/mwi/test_logger.py,sha256=zWImNitMYKPJunXWJjEDEtCEKwBz615PC844ZLwoxIg,1845
|
|
98
|
+
tests/unit/util/mwi/test_token_auth.py,sha256=-eBsaQ5JC7pyd9PXt48Rqs4cWjg6I-eOkp_gFVEwYhk,10538
|
|
99
|
+
tests/unit/util/mwi/test_validators.py,sha256=YeOP0-T7SFNeiC7JIQj7cV4ja3d6PhswsTz27IEgJHQ,10852
|
|
100
|
+
tests/unit/util/mwi/embedded_connector/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
|
|
101
|
+
tests/unit/util/mwi/embedded_connector/test_helpers.py,sha256=vYTWNUTuDeaygo16JGMTvWeI_CLOnvPkwNJmLndvJhE,890
|
|
102
|
+
tests/unit/util/mwi/embedded_connector/test_request.py,sha256=PR-jddnXDEiip-lD7A_QSvRwEkwo3eQ8owZlk-r9vnk,1867
|
|
83
103
|
tests/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
|
|
84
104
|
tests/utils/logging_util.py,sha256=VBy_NRvwau3C_CVTBjK5RMROrQimnJYHO2U0aKSZiRw,2234
|
|
85
|
-
matlab_proxy-0.
|
|
86
|
-
matlab_proxy-0.
|
|
87
|
-
matlab_proxy-0.
|
|
88
|
-
matlab_proxy-0.
|
|
89
|
-
matlab_proxy-0.
|
|
90
|
-
matlab_proxy-0.
|
|
105
|
+
matlab_proxy-0.16.0.dist-info/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
|
|
106
|
+
matlab_proxy-0.16.0.dist-info/METADATA,sha256=OhfB2b3xNfmm_1jHPjgpc2wOXa_te8IO4xxjmLNi0Q4,10108
|
|
107
|
+
matlab_proxy-0.16.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
108
|
+
matlab_proxy-0.16.0.dist-info/entry_points.txt,sha256=DbBLYgnRt8UGiOpd0zHigRTyyMdZYhMdvCvSYP7wPN0,244
|
|
109
|
+
matlab_proxy-0.16.0.dist-info/top_level.txt,sha256=9uVTjsUCAS4TwsxueTBxrBg3PdBiTSsYowAkHPv9VY0,19
|
|
110
|
+
matlab_proxy-0.16.0.dist-info/RECORD,,
|
|
@@ -12,7 +12,7 @@ import re
|
|
|
12
12
|
from requests.adapters import HTTPAdapter, Retry
|
|
13
13
|
from urllib.parse import urlparse, parse_qs
|
|
14
14
|
from tests.utils.logging_util import create_integ_test_logger
|
|
15
|
-
from
|
|
15
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
16
16
|
|
|
17
17
|
_logger = create_integ_test_logger(__name__)
|
|
18
18
|
|
|
@@ -64,9 +64,9 @@ class RealMATLABServer:
|
|
|
64
64
|
parsed_url = urlparse(utils.get_connection_string(self.mwi_app_port))
|
|
65
65
|
|
|
66
66
|
self.headers = {
|
|
67
|
-
|
|
68
|
-
parse_qs(parsed_url.query)[
|
|
69
|
-
if
|
|
67
|
+
MWI_AUTH_TOKEN_NAME_FOR_HTTP: (
|
|
68
|
+
parse_qs(parsed_url.query)[MWI_AUTH_TOKEN_NAME_FOR_HTTP][0]
|
|
69
|
+
if MWI_AUTH_TOKEN_NAME_FOR_HTTP in parse_qs(parsed_url.query)
|
|
70
70
|
else ""
|
|
71
71
|
)
|
|
72
72
|
}
|
|
@@ -6,6 +6,7 @@ import requests
|
|
|
6
6
|
from tests.utils.logging_util import create_integ_test_logger
|
|
7
7
|
import os
|
|
8
8
|
from urllib.parse import urlparse, parse_qs
|
|
9
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
9
10
|
|
|
10
11
|
_logger = create_integ_test_logger(__name__)
|
|
11
12
|
|
|
@@ -34,9 +35,9 @@ def parse_matlab_proxy_url():
|
|
|
34
35
|
parsed_url = urlparse(utils.get_connection_string(mwi_app_port))
|
|
35
36
|
|
|
36
37
|
headers = {
|
|
37
|
-
|
|
38
|
-
parse_qs(parsed_url.query)[
|
|
39
|
-
if
|
|
38
|
+
MWI_AUTH_TOKEN_NAME_FOR_HTTP: (
|
|
39
|
+
parse_qs(parsed_url.query)[MWI_AUTH_TOKEN_NAME_FOR_HTTP][0]
|
|
40
|
+
if MWI_AUTH_TOKEN_NAME_FOR_HTTP in parse_qs(parsed_url.query)
|
|
40
41
|
else ""
|
|
41
42
|
)
|
|
42
43
|
}
|
|
@@ -6,6 +6,9 @@ import requests
|
|
|
6
6
|
from requests.adapters import HTTPAdapter, Retry
|
|
7
7
|
from tests.integration.utils import integration_tests_utils as utils
|
|
8
8
|
from urllib.parse import urlparse
|
|
9
|
+
from tests.utils.logging_util import create_integ_test_logger
|
|
10
|
+
|
|
11
|
+
_logger = create_integ_test_logger(log_name=__name__)
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
def test_matlab_down(parse_matlab_proxy_url):
|
tests/unit/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Copyright 2024 The MathWorks, Inc.
|
tests/unit/conftest.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Copyright 2020-2022 The MathWorks, Inc.
|
|
2
|
+
|
|
3
|
+
""" The conftest.py file is run by the pytest framework for setting things up for the test session.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import shutil
|
|
8
|
+
import asyncio
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
from matlab_proxy import settings, util
|
|
12
|
+
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def pytest_generate_tests(metafunc):
|
|
16
|
+
os.environ[mwi_env.get_env_name_development()] = "true"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __get_matlab_config_file():
|
|
20
|
+
return settings.get(dev=True)["matlab_config_file"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def __delete_matlab_config_file():
|
|
24
|
+
os.remove(__get_matlab_config_file())
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.fixture(autouse=True, scope="session")
|
|
28
|
+
def pre_test_cleanup():
|
|
29
|
+
"""A pytest fixture which deletes matlab_config_file before executing tests.
|
|
30
|
+
|
|
31
|
+
If a previous pytest run fails, this file may have an empty Dict which leads
|
|
32
|
+
to the server never starting up matlab.
|
|
33
|
+
"""
|
|
34
|
+
try:
|
|
35
|
+
__delete_matlab_config_file()
|
|
36
|
+
except FileNotFoundError:
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
41
|
+
def cleanup(request):
|
|
42
|
+
"""Cleanup the temp directory once we are finished."""
|
|
43
|
+
|
|
44
|
+
def delete_matlab_test_dir():
|
|
45
|
+
# Delete matlab_config_file & its owning directory
|
|
46
|
+
matlab_config_file = __get_matlab_config_file()
|
|
47
|
+
matlab_config_dir = os.path.dirname(matlab_config_file)
|
|
48
|
+
try:
|
|
49
|
+
shutil.rmtree(matlab_config_dir)
|
|
50
|
+
except FileNotFoundError:
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
request.addfinalizer(delete_matlab_test_dir)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.fixture(scope="session")
|
|
57
|
+
def event_loop():
|
|
58
|
+
"""Overriding the default event loop of pytest. Intended for windows systems for
|
|
59
|
+
python <= 3.7 where WindowsSelectorEvent Loop is the default event loop. For
|
|
60
|
+
python >= 3.8, WindowsProactorEvent Loop is the default.
|
|
61
|
+
|
|
62
|
+
Yields:
|
|
63
|
+
asyncio.loop: WindowsProactorEvent loop in Windows or UnixSelectorEventLoop in posix.
|
|
64
|
+
"""
|
|
65
|
+
loop = util.get_event_loop()
|
|
66
|
+
yield loop
|
|
67
|
+
loop.close()
|