From 8c2bbaa13c48b3489cab3accb57003627b7bf4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 11 Nov 2019 14:28:12 +0100 Subject: [PATCH] new: Get Database Schema Diagnostic Fix #492 --- pymisp/aping.py | 4 ++++ tests/testlive_comprehensive.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pymisp/aping.py b/pymisp/aping.py index d5fb232..e36cd01 100644 --- a/pymisp/aping.py +++ b/pymisp/aping.py @@ -179,6 +179,10 @@ class ExpandedPyMISP(PyMISP): response = self._prepare_request('POST', f'/servers/restartWorkers') return self._check_response(response, expect_json=True) + def db_schema_diagnostic(self): + response = self._prepare_request('GET', f'/servers/dbSchemaDiagnostic') + return self._check_response(response, expect_json=True) + def toggle_global_pythonify(self): self.global_pythonify = not self.global_pythonify diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 5e02d77..db63944 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -1561,6 +1561,10 @@ class TestComprehensive(unittest.TestCase): self.assertEqual(entry.action, 'edit') r = self.admin_misp_connector.update_user({'email': 'testusr@user.local'}, self.test_usr) + def test_db_schema(self): + diag = self.admin_misp_connector.db_schema_diagnostic() + self.assertEqual(diag['actual_db_version'], diag['expected_db_version'], diag) + def test_live_acl(self): missing_acls = self.admin_misp_connector.remote_acl() self.assertEqual(missing_acls, [], msg=missing_acls)