Repository: zhmcclient/python-zhmcclient

Issue:
Console.get_audit_log() and get_security_log() use POST instead of GET
### Actual behavior

The use of `Console.get_audit_log()` results in HTTP error 405,0: "Although the resource exists, the specified method does not. [POST /api/console/operations/get-audit-log]".
Same for `get_security_log()`.

### Expected behavior

The functions succeed and return log entries as documented.

### Execution environment

* zhmcclient version: master
* Operating system (type+version): MacOS
* HMC version: 2.14.1
* CPC version: 2.14.1

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/24983814/badge)](https://coveralls.io/builds/24983814)

Coverage decreased (-0.007%) to 81.016% when pulling **92ec8f5718ef6ef496b9c87b33c090915b3356ba on andy/fix-get-logs** into **c6acd8d98a7cdf7bc38229738e7a5b8db8857147 on master**.


Patch:
diff --git a/docs/changes.rst b/docs/changes.rst
index f0f0859..9e10150 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -51,6 +51,9 @@ Released: not yet
   because the dependency management did not work with our minimum
   package versions.
 
+* Fixed use of incorrect HTTP method in `Console.get_audit_log()` and
+  `Console.get_security_log()`. See issue #580.
+
 **Enhancements:**
 
 * Improved end2end test support for zhmcclient and its using projects.
diff --git a/zhmcclient/_console.py b/zhmcclient/_console.py
index df7a103..c862560 100644
--- a/zhmcclient/_console.py
+++ b/zhmcclient/_console.py
@@ -465,7 +465,7 @@ class Console(BaseResource):
         """
         query_parms = self._time_query_parms(begin_time, end_time)
         uri = self.uri + '/operations/get-audit-log' + query_parms
-        result = self.manager.session.post(uri)
+        result = self.manager.session.get(uri)
         return result
 
     @logged_api_call
@@ -510,7 +510,7 @@ class Console(BaseResource):
         """
         query_parms = self._time_query_parms(begin_time, end_time)
         uri = self.uri + '/operations/get-security-log' + query_parms
-        result = self.manager.session.post(uri)
+        result = self.manager.session.get(uri)
         return result
 
     @logged_api_call
diff --git a/zhmcclient_mock/_urihandler.py b/zhmcclient_mock/_urihandler.py
index fd70670..315103e 100644
--- a/zhmcclient_mock/_urihandler.py
+++ b/zhmcclient_mock/_urihandler.py
@@ -485,10 +485,8 @@ class ConsoleReorderUserPatternsHandler(object):
 class ConsoleGetAuditLogHandler(object):
 
     @staticmethod
-    def post(method, hmc, uri, uri_parms, body, logon_required,
-             wait_for_completion):
+    def get(method, hmc, uri, uri_parms, logon_required):
         """Operation: Get Console Audit Log."""
-        assert wait_for_completion is True  # synchronous operation
         console_uri = '/api/console'
         try:
             hmc.lookup_by_uri(console_uri)
@@ -502,10 +500,8 @@ class ConsoleGetAuditLogHandler(object):
 class ConsoleGetSecurityLogHandler(object):
 
     @staticmethod
-    def post(method, hmc, uri, uri_parms, body, logon_required,
-             wait_for_completion):
+    def get(method, hmc, uri, uri_parms, logon_required):
         """Operation: Get Console Security Log."""
-        assert wait_for_completion is True  # synchronous operation
         console_uri = '/api/console'
         try:
             hmc.lookup_by_uri(console_uri)


Test patch:
diff --git a/tests/unit/zhmcclient_mock/test_urihandler.py b/tests/unit/zhmcclient_mock/test_urihandler.py
index 66c25b2..d56e9c0 100644
--- a/tests/unit/zhmcclient_mock/test_urihandler.py
+++ b/tests/unit/zhmcclient_mock/test_urihandler.py
@@ -1219,9 +1219,8 @@ class TestConsoleGetAuditLogHandler(object):
     def test_get_audit_log_success(self):
 
         # the function to be tested:
-        resp = self.urihandler.post(
-            self.hmc, '/api/console/operations/get-audit-log', None, True,
-            True)
+        resp = self.urihandler.get(
+            self.hmc, '/api/console/operations/get-audit-log', True)
 
         assert resp == []
 
@@ -1235,9 +1234,8 @@ class TestConsoleGetAuditLogHandler(object):
         with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
-            self.urihandler.post(
-                self.hmc, '/api/console/operations/get-audit-log', None, True,
-                True)
+            self.urihandler.get(
+                self.hmc, '/api/console/operations/get-audit-log', True)
 
         exc = exc_info.value
         assert exc.reason == 1
@@ -1259,9 +1257,8 @@ class TestConsoleGetSecurityLogHandler(object):
     def test_get_security_log_success_empty(self):
 
         # the function to be tested:
-        resp = self.urihandler.post(
-            self.hmc, '/api/console/operations/get-security-log', None, True,
-            True)
+        resp = self.urihandler.get(
+            self.hmc, '/api/console/operations/get-security-log', True)
 
         assert resp == []
 
@@ -1275,9 +1272,8 @@ class TestConsoleGetSecurityLogHandler(object):
         with pytest.raises(InvalidResourceError) as exc_info:
 
             # the function to be tested:
-            self.urihandler.post(
-                self.hmc, '/api/console/operations/get-security-log', None,
-                True, True)
+            self.urihandler.get(
+                self.hmc, '/api/console/operations/get-security-log', True)
 
         exc = exc_info.value
         assert exc.reason == 1