summaryrefslogtreecommitdiff
path: root/saharaclient/tests/unit/test_jobs.py
diff options
context:
space:
mode:
Diffstat (limited to 'saharaclient/tests/unit/test_jobs.py')
-rw-r--r--saharaclient/tests/unit/test_jobs.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/saharaclient/tests/unit/test_jobs.py b/saharaclient/tests/unit/test_jobs.py
index 39acb7c..b5e2ec2 100644
--- a/saharaclient/tests/unit/test_jobs.py
+++ b/saharaclient/tests/unit/test_jobs.py
@@ -96,6 +96,7 @@ class JobTest(base.BaseTestCase):
self.responses.patch(url, status_code=202, json=update_body)
+ # check that all parameters will be updated
resp = self.client.jobs.update('id', name='new_name',
description='description')
@@ -103,3 +104,20 @@ class JobTest(base.BaseTestCase):
self.assertIsInstance(resp, jobs.Job)
self.assertEqual(update_body,
json.loads(self.responses.last_request.body))
+
+ # check that parameters will not be updated
+ self.client.jobs.update("id")
+ self.assertEqual(url, self.responses.last_request.url)
+ self.assertEqual({},
+ json.loads(self.responses.last_request.body))
+
+ # check that all parameters will be unset
+ unset_json = {
+ "name": None, "description": None, "is_public": None,
+ "is_protected": None
+ }
+
+ self.client.jobs.update("id", **unset_json)
+ self.assertEqual(url, self.responses.last_request.url)
+ self.assertEqual(unset_json,
+ json.loads(self.responses.last_request.body))