more test fixes

This commit is contained in:
sadnub 2020-09-29 22:51:28 -04:00
parent 56db0781ea
commit 3f8f9691f4
2 changed files with 7 additions and 7 deletions

View File

@ -74,14 +74,14 @@ class TestWinUpdateViews(TacticalTestCase):
# can't get this to work right
# test agent command no pid field
#mock_cmd.return_value = ""
#resp = self.client.get(url, format="json")
#self.assertEqual(resp.status_code, 400)
mock_cmd.return_value = {}
resp = self.client.get(url, format="json")
self.assertEqual(resp.status_code, 400)
# test agent command success
# mock_cmd.return_value = {"pid", 3316}
# resp = self.client.get(url, format="json")
# self.assertEqual(resp.status_code, 200)
mock_cmd.return_value = {"pid": 3316}
resp = self.client.get(url, format="json")
self.assertEqual(resp.status_code, 200)
def test_edit_policy(self):
url = "/winupdate/editpolicy/"

View File

@ -47,7 +47,7 @@ def install_updates(request, pk):
# successful response: {'return': [{'SALT-ID': {'pid': 3316}}]}
try:
r["pid"]
except KeyError:
except (KeyError):
return notify_error(str(r))
return Response(f"Patches will now be installed on {agent.hostname}")