Skip to content

Commit

Permalink
python unit tests fixes when run in suite; issue with scheduler share…
Browse files Browse the repository at this point in the history
…d instance is not resetting on completion of test scenario (#1203)

Signed-off-by: ashish-jabble <[email protected]>
  • Loading branch information
ashish-jabble authored Oct 18, 2023
1 parent 1be1406 commit a0a176f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async def test_get_all_scripts(self, client):
with patch.object(c_mgr, 'get_category_all_items', return_value=get_cat) as patch_get_all_items:
resp = await client.get('/fledge/control/script')
assert 200 == resp.status
server.Server.scheduler = None
result = await resp.text()
json_response = json.loads(result)
assert 'scripts' in json_response
Expand Down Expand Up @@ -162,6 +163,7 @@ async def mock_manual_schedule(name):
with patch.object(server.Server.scheduler, 'get_schedule_by_name',
return_value=get_sch) as patch_get_schedule_by_name:
resp = await client.get('/fledge/control/script/{}'.format(script_name))
server.Server.scheduler = None
assert 200 == resp.status
result = await resp.text()
json_response = json.loads(result)
Expand Down Expand Up @@ -583,6 +585,7 @@ def d_schedule(*args):
with patch.object(AuditLogger, 'information',
return_value=arv) as audit_info_patch:
resp = await client.delete('/fledge/control/script/{}'.format(script_name))
server.Server.scheduler = None
assert 200 == resp.status
result = await resp.text()
json_response = json.loads(result)
Expand Down Expand Up @@ -739,6 +742,7 @@ async def test_schedule_found_for_configuration_script(self, client):
with patch.object(server.Server.scheduler, 'get_schedules',
return_value=get_sch) as patch_get_schedules:
resp = await client.post('/fledge/control/script/{}/schedule'.format(script_name))
server.Server.scheduler = None
assert 400 == resp.status
result = await resp.text()
json_response = json.loads(result)
Expand Down Expand Up @@ -788,6 +792,7 @@ async def test_schedule_configuration_for_script(self, client):
with patch.object(server.Server.scheduler, 'queue_task',
return_value=queue) as patch_queue_task:
resp = await client.post('/fledge/control/script/{}/schedule'.format(script_name))
server.Server.scheduler = None
assert 200 == resp.status
result = await resp.text()
json_response = json.loads(result)
Expand Down

0 comments on commit a0a176f

Please sign in to comment.