Skip to content

Commit

Permalink
Add additional lancium adapter tests for exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
giffels committed Feb 16, 2023
1 parent 5385189 commit 709453d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/adapters_t/sites_t/test_lancium.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@ def run_it(job_id):
id=int(job_id)
)

self.mocked_lancium_api.jobs.terminate_job.side_effect = AuthError(
"operation=auth_error", {}
)
with self.assertRaises(AuthError):
run_it(123)
for exception in (AuthError, ClientError):
self.mocked_lancium_api.jobs.terminate_job.side_effect = exception(
"test", AttributeDict
)
with self.assertRaises(exception):
run_it(123)

def test_terminate_resource(self):
def run_it(job_id):
Expand All @@ -268,11 +269,12 @@ def run_it(job_id):
run_it(job_id)
self.mocked_lancium_api.jobs.delete_job.assert_called_with(id=int(job_id))

self.mocked_lancium_api.jobs.delete_job.side_effect = AuthError(
"operation=auth_error", {}
)
with self.assertRaises(AuthError):
run_it(123)
for exception in (AuthError, ClientError):
self.mocked_lancium_api.jobs.delete_job.side_effect = exception(
"test", AttributeDict()
)
with self.assertRaises(exception):
run_it(123)

def test_exception_handling(self):
with self.assertRaises(TardisError):
Expand Down

0 comments on commit 709453d

Please sign in to comment.