Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b04c0ec

Browse files
diningPhilosopher64Prabhakar Kumar
authored andcommittedJun 19, 2023
v0.7.0 : Ability to specify to matlab-proxy that MATLAB is already licensed.
1 parent b9a2ec7 commit b04c0ec

File tree

20 files changed

+463
-134
lines changed

20 files changed

+463
-134
lines changed
 

‎Advanced-Usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The following table describes all the environment variables that you can set to
2828
| **MWI_SSL_KEY_FILE** | string | `"/path/to/keyfile.key"` | The keyfile string, if present, must point to a file containing the private key. Otherwise the private key will be taken from certfile as well. |
2929
| **MWI_ENABLE_TOKEN_AUTH** | string | `"True"` | When set to `True`, matlab-proxy will require users to provide the security token to access the proxy. <br />The default value is `False` . See [Token-Based Authentication](./SECURITY.md#token-based-authentication) for more information.|
3030
| **MWI_AUTH_TOKEN** | string (optional) | `"AnyURLSafeToken"` | Optionally, provide a custom `token` for use with `MWI_ENABLE_TOKEN_AUTH`. A token can safely contain any combination of alpha numeric text along with the following permitted characters: `- . _ ~`.<br />When absent matlab-proxy will generate a random URL safe token. |
31+
| **MWI_USE_EXISTING_LICENSE** | string (optional) | `"True"` | When set to True, matlab-proxy will not ask you for additional licensing information and will try to launch an already activated MATLAB on your system PATH.
3132

3233

3334
## Custom HTTP Headers

‎README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ Install the version >=0.5.0 to use the package on MacOS.
162162
$ pip install --upgrade matlab-proxy>=0.5.0
163163
```
164164

165+
## Using an already activated MATLAB with matlab-proxy
166+
`matlab-proxy` version `v0.7.0` introduces support for using an existing MATLAB license. Use the Existing License option only if you have an activated MATLAB. This allows you to start MATLAB without authenticating every time.
167+
165168
## Limitations
166169
This package supports the same subset of MATLAB features and commands as MATLAB® Online, except there is no support for Simulink® Online.
167170
[Click here for a full list of Specifications and Limitations for MATLAB Online](https://www.mathworks.com/products/matlab-online/limitations.html).

‎gui/src/components/Controls/index.js

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// Copyright (c) 2020-2022 The MathWorks, Inc.
1+
// Copyright (c) 2020-2023 The MathWorks, Inc.
22

33
import React, { useMemo } from 'react';
44
import PropTypes from 'prop-types';
55
import { useSelector } from 'react-redux';
66
import ReactTooltip from 'react-tooltip';
77
import {
88
selectSubmittingServerStatus,
9-
selectLicensingIsMhlm,
9+
selectLicensingInfo,
1010
selectLicensingProvided,
1111
selectMatlabUp,
1212
selectMatlabStarting,
@@ -36,7 +36,6 @@ function Controls({
3636
}) {
3737
const submitting = useSelector(selectSubmittingServerStatus);
3838
const licensed = useSelector(selectLicensingProvided);
39-
const mhlmLicense = useSelector(selectLicensingIsMhlm);
4039
const matlabStarting = useSelector(selectMatlabStarting);
4140
const matlabUp = useSelector(selectMatlabUp);
4241
const matlabStopping = useSelector(selectMatlabStopping);
@@ -45,6 +44,7 @@ function Controls({
4544
const error = useSelector(selectError);
4645
const authEnabled = useSelector(selectAuthEnabled);
4746
const isAuthenticated = useSelector(selectIsAuthenticated);
47+
const licensingInfo = useSelector(selectLicensingInfo);
4848
const canResetLicensing = licensed && !submitting;
4949

5050
const feedbackBody = useMemo(
@@ -55,6 +55,41 @@ MATLAB version: ${matlabVersion}%0D%0A`,
5555
[matlabVersion]
5656
);
5757

58+
let licensingData, licensingConfirmationMessage;
59+
switch (licensingInfo?.type) {
60+
case "mhlm":
61+
licensingData = {
62+
label: 'Sign Out',
63+
dataTip : 'Sign out of MATLAB',
64+
};
65+
licensingConfirmationMessage = `Are you sure you want to sign out of MATLAB?`
66+
break;
67+
case "nlm":
68+
licensingData = {
69+
label: 'Remove License Server Address',
70+
dataTip : 'Remove the network license manager server address',
71+
};
72+
licensingConfirmationMessage = `Are you sure you want to remove the network license manager server address?`
73+
break;
74+
75+
case "existing_license":
76+
licensingData = {
77+
label: 'Stop using Existing License',
78+
dataTip : 'Stop using existing license',
79+
};
80+
licensingConfirmationMessage = `Are you sure you want to stop using an Existing License?`
81+
break;
82+
83+
default:
84+
licensingData = {
85+
label: 'None',
86+
dataTip : 'None',
87+
};
88+
licensingConfirmationMessage = null
89+
}
90+
91+
92+
5893
const Confirmations = {
5994
START: {
6095
type: 'confirmation',
@@ -73,7 +108,7 @@ MATLAB version: ${matlabVersion}%0D%0A`,
73108
},
74109
SIGN_OUT: {
75110
type: 'confirmation',
76-
message: `Are you sure you want to ${mhlmLicense ? 'sign out of MATLAB' : 'unset the connection string'}?`,
111+
message: licensingConfirmationMessage,
77112
callback: fetchUnsetLicensing
78113
},
79114
HELP: {
@@ -92,7 +127,7 @@ MATLAB version: ${matlabVersion}%0D%0A`,
92127
return cls + 'btn_color_blue';
93128
}
94129
return cls + 'btn_color_mediumgray';
95-
};
130+
};
96131

97132
return (
98133
<div id="controls" className="labels-on-top">
@@ -127,10 +162,10 @@ MATLAB version: ${matlabVersion}%0D%0A`,
127162
onClick={() => callback(Confirmations.SIGN_OUT)}
128163
disabled={!canResetLicensing || (authEnabled && !isAuthenticated)}
129164
data-for="control-button-tooltip"
130-
data-tip={mhlmLicense ? 'Sign out' : 'Unset the network license manager server address'}
165+
data-tip= {licensingData.dataTip}
131166
>
132167
<span className='icon-custom-sign-out'></span>
133-
<span className='btn-label'>{mhlmLicense ? 'Sign Out' : 'Unset License Server Address'}</span>
168+
<span className='btn-label'>{licensingData.label}</span>
134169
</button>
135170
{/* <button
136171
id="terminateIntegration"

‎gui/src/components/Information/Information.spec.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Information Component', () => {
2020
tutorialHidden: false,
2121
overlayVisibility: false,
2222
serverStatus: {
23-
licensingInfo: { type: 'MHLM', emailAddress: 'abc@mathworks.com' },
23+
licensingInfo: { type: 'mhlm', emailAddress: 'abc@mathworks.com' },
2424
matlabStatus: 'up',
2525
matlabVersion: 'R2020b',
2626
isFetching: false,
@@ -71,7 +71,7 @@ describe('Information Component', () => {
7171
});
7272

7373
it('should render Online Licensing info with licensing type MHLM', () => {
74-
const { container, debug, getByText } = render(
74+
const { getByText } = render(
7575
<Information closeHandler={closeHandler} children={children} />,
7676
{ initialState: initialState }
7777
);
@@ -85,10 +85,10 @@ describe('Information Component', () => {
8585

8686
it('should render Online Licensing info with licensing type NLM', () => {
8787
initialState.serverStatus.licensingInfo = {
88-
type: 'NLM',
88+
type: 'nlm',
8989
connectionString: 'abc@nlm',
9090
};
91-
const { container, debug, getByText } = render(
91+
const { getByText } = render(
9292
<Information closeHandler={closeHandler} children={children} />,
9393
{ initialState: initialState }
9494
);
@@ -100,6 +100,19 @@ describe('Information Component', () => {
100100
);
101101
});
102102

103+
it('should render Existing License with licensing type existing_license', () => {
104+
initialState.serverStatus.licensingInfo = {
105+
type: 'existing_license',
106+
};
107+
const { getByText } = render(
108+
<Information closeHandler={closeHandler} children={children} />,
109+
{ initialState: initialState }
110+
);
111+
112+
const licensingInfo = getByText('Licensing:');
113+
expect(licensingInfo.nextSibling.textContent).toEqual("Existing License");
114+
});
115+
103116
it('should display errors', () => {
104117
initialState.error = {
105118
message: 'Exited with exit code -9',

‎gui/src/components/Information/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
selectInformationDetails,
1212
selectAuthEnabled,
1313
selectIsAuthenticated,
14-
selectAuthToken
14+
selectAuthToken,
1515
} from '../../selectors';
1616
import { updateAuthStatus } from '../../actionCreators';
1717
import './Information.css';
@@ -39,16 +39,21 @@ function Information({
3939

4040
let info;
4141
switch (licensingInfo?.type) {
42-
case "MHLM":
42+
case "mhlm":
4343
info = {
4444
label: `Online License Manager (${licensingInfo.emailAddress})`
4545
};
4646
break;
47-
case "NLM":
47+
case "nlm":
4848
info = {
4949
label: `Network License Manager (${licensingInfo.connectionString})`
5050
};
5151
break;
52+
case "existing_license":
53+
info = {
54+
label : 'Existing License'
55+
};
56+
break;
5257
default:
5358
info = {
5459
label: 'None'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
label {
2+
padding-left: 5px;
3+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import { useDispatch } from 'react-redux';
3+
import {
4+
fetchSetLicensing
5+
} from '../../actionCreators';
6+
import "./ExistingLicense.css"
7+
8+
9+
10+
function ExistingLicense() {
11+
const dispatch = useDispatch();
12+
13+
function submitForm(event) {
14+
event.preventDefault();
15+
dispatch(fetchSetLicensing({
16+
'type': 'existing_license',
17+
}));
18+
}
19+
20+
return (
21+
<div id="ExistingLicense">
22+
<form onSubmit={submitForm}>
23+
<div className='form-group'>
24+
<p>
25+
<b>Note</b>: Choose this option if you already have an activated MATLAB license. This option allows you to run MATLAB on your host machine without providing additional licensing information.
26+
</p>
27+
<br/>
28+
<input type="submit" id="submit" value="Start MATLAB" className="btn btn_color_blue" />
29+
</div>
30+
</form>
31+
</div>
32+
)
33+
}
34+
35+
export default ExistingLicense;

‎gui/src/components/LicensingGatherer/LicenseGatherer.spec.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('LicenseGatherer component', () => {
1515
overlayVisibility: false,
1616

1717
serverStatus: {
18-
licensingInfo: { type: 'MHLM', emailAddress: 'abc@mathworks.com' },
18+
licensingInfo: { type: 'mhlm', emailAddress: 'abc@mathworks.com' },
1919
matlabStatus: 'up',
2020
matlabVersion: 'R2020b',
2121
isFetching: false,
@@ -63,7 +63,7 @@ describe('LicenseGatherer component', () => {
6363

6464
initialState.serverStatus.wsEnv = 'mw-integ'
6565

66-
const { container, debug } = render(<LicenseGatherer />, { initialState: initialState });
66+
const { container } = render(<LicenseGatherer />, { initialState: initialState });
6767

6868
const mhlmTab = container.querySelector('#mhlm-tab');
6969

@@ -99,11 +99,24 @@ describe('LicenseGatherer component', () => {
9999
// Click on nlm Tab
100100
fireEvent.click(nlmTab);
101101

102-
// Check if nlm iframe is rendered.
102+
// Check if nlm tab is rendered.
103103
const nlmTabContent = container.querySelector('#NLM');
104104
expect(nlmTabContent).toBeInTheDocument();
105105
});
106106

107+
it('should have rendered existing license tab content without crashing', () => {
108+
const { container } = render(<LicenseGatherer />, { initialState: initialState });
109+
110+
const existingLicenseTab = container.querySelector('#existingLicense-tab');
111+
expect(existingLicenseTab).toBeInTheDocument();
112+
113+
// Click on existingLicense Tab
114+
fireEvent.click(existingLicenseTab);
115+
116+
// Check if existingLicense tab is rendered.
117+
const existingLicenseTabContent = container.querySelector('#existingLicense');
118+
expect(existingLicenseTabContent).toBeInTheDocument();
119+
});
107120

108121
test.each([
109122
['1234', true], ['hostname', true], ['1234hostname', true], ['1234,', true], ['hostname,', true],

‎gui/src/components/LicensingGatherer/MHLM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function MHLM() {
102102
} else if (data.event === 'login') {
103103
// Persist credentials to serverside
104104
dispatch(fetchSetLicensing({
105-
type: 'MHLM',
105+
type: 'mhlm',
106106
token: data.token,
107107
profileId: data.profileId,
108108
emailAddress: data.emailAddress,

‎gui/src/components/LicensingGatherer/NLM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function NLM() {
5050
function submitForm(event) {
5151
event.preventDefault();
5252
dispatch(fetchSetLicensing({
53-
'type': 'NLM',
53+
'type': 'nlm',
5454
'connectionString': connStr
5555
}));
5656
}

‎gui/src/components/LicensingGatherer/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import React, { useState } from 'react';
44
import MHLM from './MHLM';
55
import NLM from './NLM';
6+
import ExistingLicense from './ExistingLicense';
67
import './LicensingGatherer.css';
78

89
function LicensingGatherer() {
@@ -18,11 +19,17 @@ function LicensingGatherer() {
1819
e.preventDefault();
1920
setActiveTab("nlm");
2021
};
22+
const handleExistingLicenseTabClick = e => {
23+
e.preventDefault();
24+
setActiveTab("existingLicense");
25+
};
2126

2227
const mhlmActive = activeTab === "mhlm" ? "active" : "";
2328
const mhlmAriaExpanded = activeTab === "mhlm" ? "true" : "false";
2429
const nlmActive = activeTab === "nlm" ? "active" : "";
2530
const nlmAriaExpanded = activeTab === "nlm" ? "true" : "false";
31+
const existingLicenseActive = activeTab === "existingLicense" ? "active" : "";
32+
const existingLicenseAriaExpanded = activeTab === "existingLicense" ? "true" : "false";
2633

2734
return (
2835
<div className="modal show" id="setup-dialog" tabIndex="-1" role="dialog" aria-labelledby="setup-dialog-title">
@@ -49,6 +56,15 @@ function LicensingGatherer() {
4956
aria-controls="nlm"
5057
aria-expanded={nlmAriaExpanded}>Network License Manager</a>
5158
</li>
59+
<li role="presentation" className={existingLicenseActive}>
60+
<a
61+
href="#existingLicense"
62+
id="existingLicense-tab"
63+
onClick={handleExistingLicenseTabClick}
64+
role="tab"
65+
aria-controls="existingLicense"
66+
aria-expanded={existingLicenseAriaExpanded}>Existing License</a>
67+
</li>
5268
</ul>
5369
{/* Because the MHLM tab contains an iframe which is slow to load, always render both tabs and select the active one with React */}
5470
<div id="setup-tabs-content" className="tab-content">
@@ -58,6 +74,9 @@ function LicensingGatherer() {
5874
<div role="tabpanel" className={`tab-pane ${nlmActive}`} id="nlm" aria-labelledby="nlm-tab">
5975
<NLM />
6076
</div>
77+
<div role="tabpanel" className={`tab-pane ${existingLicenseActive}`} id="existingLicense" aria-labelledby="existingLicense-tab">
78+
<ExistingLicense />
79+
</div>
6180
<div>
6281
<p id="LicensingGathererNote">
6382
For more details, see&nbsp;
@@ -70,7 +89,7 @@ function LicensingGatherer() {
7089
</a>
7190
</p>
7291
</div>
73-
</div>
92+
</div>
7493
</div>
7594
</div>
7695
</div>

‎img/licensing_GUI.png

7.35 KB
Loading

‎matlab_proxy/app.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,25 @@ def marshal_licensing_info(licensing_info):
5151
if licensing_info is None:
5252
return None
5353

54-
if licensing_info["type"] == "mhlm":
54+
licensing_type = licensing_info.get("type")
55+
56+
if licensing_type is None:
57+
return None
58+
59+
if licensing_type == "mhlm":
5560
return {
56-
"type": "MHLM",
61+
"type": "mhlm",
5762
"emailAddress": licensing_info["email_addr"],
5863
"entitlements": licensing_info.get("entitlements", []),
5964
"entitlementId": licensing_info.get("entitlement_id", None),
6065
}
61-
elif licensing_info["type"] == "nlm":
66+
elif licensing_type == "nlm":
6267
return {
63-
"type": "NLM",
68+
"type": "nlm",
6469
"connectionString": licensing_info["conn_str"],
6570
}
71+
elif licensing_type == "existing_license":
72+
return {"type": "existing_license"}
6673

6774

6875
def marshal_error(error):
@@ -233,15 +240,19 @@ async def set_licensing_info(req):
233240
lic_type = data.get("type")
234241

235242
try:
236-
if lic_type == "NLM":
243+
if lic_type == "nlm":
237244
await state.set_licensing_nlm(data.get("connectionString"))
238245

239-
elif lic_type == "MHLM":
246+
elif lic_type == "mhlm":
240247
await state.set_licensing_mhlm(
241248
data.get("token"), data.get("emailAddress"), data.get("sourceId")
242249
)
250+
elif lic_type == "existing_license":
251+
state.set_licensing_existing_license()
243252
else:
244-
raise Exception('License type must be "NLM" or "MHLM"!')
253+
raise Exception(
254+
'License type must be "NLM" or "MHLM" or "ExistingLicense"!'
255+
)
245256
except Exception as e:
246257
raise web.HTTPBadRequest(text="Error with licensing!")
247258

‎matlab_proxy/app_state.py

Lines changed: 231 additions & 100 deletions
Large diffs are not rendered by default.

‎matlab_proxy/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def get_dev_settings(config):
9292
"mwi_auth_status": False,
9393
"mwi_auth_token": mwi_auth_token,
9494
"mwi_auth_token_name": mwi_env.get_env_name_mwi_auth_token().lower(),
95+
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
96+
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
97+
),
9598
}
9699

97100

@@ -213,6 +216,9 @@ def get(config_name=matlab_proxy.get_default_config_name(), dev=False):
213216
"mwi_auth_status": False,
214217
"mwi_auth_token": mwi_auth_token,
215218
"mwi_auth_token_name": mwi_env.get_env_name_mwi_auth_token().lower(),
219+
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
220+
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
221+
),
216222
}
217223

218224

‎matlab_proxy/util/mwi/embedded_connector/request.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ async def get_state(mwi_server_url):
6868
url = get_ping_endpoint(mwi_server_url)
6969
try:
7070
resp = await send_request(url=url, data=data, method="POST")
71+
72+
# Additional assert statements to catch any changes in response from embedded connector
73+
# Tested from R2020b to R2023a
74+
assert (
75+
"messages" in resp
76+
), '"messages" key missing in response from embedded connector'
77+
assert (
78+
"PingResponse" in resp["messages"]
79+
), '"PingResponse" key missing in response from embedded connector'
80+
assert (
81+
type(resp["messages"]["PingResponse"]) == list
82+
), 'Was expecting an array in the "PingResponse" field in response'
83+
assert (
84+
len(resp["messages"]["PingResponse"]) == 1
85+
), 'Was expecting an array of length 1 in the "PingResponse" field in response'
86+
assert (
87+
"messageFaults" in resp["messages"]["PingResponse"][0]
88+
), 'Was expecting "messageFaults" field in response'
89+
7190
if not resp["messages"]["PingResponse"][0]["messageFaults"]:
7291
return "up"
7392
except Exception:

‎matlab_proxy/util/mwi/environment_variables.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ def get_env_name_mwi_auth_token():
140140
def get_env_name_matlab_log_dir():
141141
"""Returns the key used for MATLAB log dir env variable"""
142142
return "MATLAB_LOG_DIR"
143+
144+
145+
def get_env_name_mwi_use_existing_license():
146+
"""Returns the environment variable name used to instruct matlab-proxy to use an existing license. Usually used by already activated MATLAB installations."""
147+
return "MWI_USE_EXISTING_LICENSE"

‎matlab_proxy/util/mwi/validators.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,15 @@ def validate_ssl_key_and_cert_file(a_ssl_key_file, a_ssl_cert_file):
264264
f"SSL Keys provided were: MWI_SSL_CERT_FILE: {a_ssl_cert_file} & MWI_SSL_KEY_FILE: {a_ssl_key_file}"
265265
)
266266
return a_ssl_key_file, a_ssl_cert_file
267+
268+
269+
def validate_use_existing_licensing(use_existing_license):
270+
"""Returns true if use_existing_license is true
271+
272+
Args:
273+
use_existing_license (str): value from the environment variable MWI_USE_EXISTING_LICENSE
274+
275+
Returns:
276+
bool: if use_existing_license is set to true
277+
"""
278+
return True if use_existing_license.casefold() == "true" else False

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def run(self):
6565

6666
setuptools.setup(
6767
name="matlab-proxy",
68-
version="0.6.0",
68+
version="0.7.0",
6969
url=config["doc_url"],
7070
author="The MathWorks, Inc.",
7171
author_email="cloud@mathworks.com",

‎tests/test_app.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,26 @@ def get_connection_string():
5353
{
5454
"input": {"type": "mhlm", "email_addr": get_email()},
5555
"expected": {
56-
"type": "MHLM",
56+
"type": "mhlm",
5757
"emailAddress": get_email(),
5858
"entitlements": [],
5959
"entitlementId": None,
6060
},
6161
},
6262
{
6363
"input": {"type": "nlm", "conn_str": get_connection_string()},
64-
"expected": {"type": "NLM", "connectionString": get_connection_string()},
64+
"expected": {"type": "nlm", "connectionString": get_connection_string()},
65+
},
66+
{
67+
"input": {"type": "existing_license"},
68+
"expected": {"type": "existing_license"},
6569
},
6670
],
6771
ids=[
6872
"No Licensing info supplied",
69-
"Licensing type is MHLM",
70-
"Licensing type is NLM",
73+
"Licensing type is mhlm",
74+
"Licensing type is nlm",
75+
"Licensing type is existing_license",
7176
],
7277
)
7378
def licensing_info_fixture(request):
@@ -466,7 +471,7 @@ async def test_set_licensing_info_put_nlm(test_server):
466471
"""
467472

468473
data = {
469-
"type": "NLM",
474+
"type": "nlm",
470475
"status": "starting",
471476
"version": "R2020b",
472477
"connectionString": "abc@nlm",
@@ -502,7 +507,7 @@ async def test_set_licensing_info_put_mhlm(test_server):
502507
"""
503508

504509
data = {
505-
"type": "MHLM",
510+
"type": "mhlm",
506511
"status": "starting",
507512
"version": "R2020b",
508513
"token": "abc@nlm",
@@ -513,6 +518,19 @@ async def test_set_licensing_info_put_mhlm(test_server):
513518
assert resp.status == 200
514519

515520

521+
async def test_set_licensing_info_put_existing_license(test_server):
522+
"""Test to check endpoint : "/set_licensing_info"
523+
524+
Test which sends HTTP PUT request with local licensing information.
525+
Args:
526+
test_server (aiohttp_client): A aiohttp_client server to send HTTP GET request.
527+
"""
528+
529+
data = {"type": "existing_license"}
530+
resp = await test_server.put("/set_licensing_info", data=json.dumps(data))
531+
assert resp.status == 200
532+
533+
516534
async def test_set_licensing_info_delete(test_server):
517535
"""Test to check endpoint : "/set_licensing_info"
518536

0 commit comments

Comments
 (0)
Please sign in to comment.