From 3f8f9691f4e051fe2284c788cff8f7d19ad9ad62 Mon Sep 17 00:00:00 2001 From: sadnub Date: Tue, 29 Sep 2020 22:51:28 -0400 Subject: [PATCH] more test fixes --- api/tacticalrmm/winupdate/tests.py | 12 ++++++------ api/tacticalrmm/winupdate/views.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/tacticalrmm/winupdate/tests.py b/api/tacticalrmm/winupdate/tests.py index 1ac17529..3e19206e 100644 --- a/api/tacticalrmm/winupdate/tests.py +++ b/api/tacticalrmm/winupdate/tests.py @@ -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/" diff --git a/api/tacticalrmm/winupdate/views.py b/api/tacticalrmm/winupdate/views.py index 46c70715..7971dde0 100644 --- a/api/tacticalrmm/winupdate/views.py +++ b/api/tacticalrmm/winupdate/views.py @@ -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}")