From 65356584463de650fe6c2a626bf66aa16a279740 Mon Sep 17 00:00:00 2001 From: computermacgyver Date: Mon, 30 Sep 2024 18:39:24 +0100 Subject: [PATCH 1/2] no langid in healthcheck --- app/main/controller/healthcheck_controller.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/main/controller/healthcheck_controller.py b/app/main/controller/healthcheck_controller.py index e5715458..9da4e2c1 100644 --- a/app/main/controller/healthcheck_controller.py +++ b/app/main/controller/healthcheck_controller.py @@ -19,7 +19,7 @@ def get(self): 'ELASTICSEARCH_SIMILARITY': False, 'REDIS': False, 'DATABASE': False, - 'LANGID': False + # 'LANGID': False } # Elasticsearch @@ -50,11 +50,11 @@ def get(self): except Exception as e: result['DATABASE'] = str(e) - # Langid - try: - class_ = getattr(importlib.import_module('app.main.lib.langid'), app.config['PROVIDER_LANGID'].title() + 'LangidProvider') - result['LANGID'] = class_.test() - except Exception as e: - result['LANGID'] = '%s: %s' % (app.config['PROVIDER_LANGID'].title() + 'LangidProvider', str(e)) + # # Langid + # try: + # class_ = getattr(importlib.import_module('app.main.lib.langid'), app.config['PROVIDER_LANGID'].title() + 'LangidProvider') + # result['LANGID'] = class_.test() + # except Exception as e: + # result['LANGID'] = '%s: %s' % (app.config['PROVIDER_LANGID'].title() + 'LangidProvider', str(e)) return { 'result': result }, 200 if all(x and type(x) == type(True) for x in result.values()) else 500 From 9a047f217e2363424b732b95040707f8e6348df4 Mon Sep 17 00:00:00 2001 From: computermacgyver Date: Mon, 30 Sep 2024 22:51:24 +0100 Subject: [PATCH 2/2] Remove test related to langid in healthcheck --- app/test/test_healthcheck.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_healthcheck.py b/app/test/test_healthcheck.py index d9d790cb..d06fd1e2 100644 --- a/app/test/test_healthcheck.py +++ b/app/test/test_healthcheck.py @@ -66,11 +66,11 @@ def test_healthcheck_api_with_bad_config(self): self.assertEqual('application/json', response.content_type) self.assertEqual(500, response.status_code) - def test_healthcheck_api_with_import_error(self): - with patch.dict('sys.modules', {'app.main.lib.langid': None}): - response = self.client.get('/healthcheck/') - self.assertEqual('application/json', response.content_type) - self.assertEqual(500, response.status_code) + # def test_healthcheck_api_with_import_error(self): + # with patch.dict('sys.modules', {'app.main.lib.langid': None}): + # response = self.client.get('/healthcheck/') + # self.assertEqual('application/json', response.content_type) + # self.assertEqual(500, response.status_code) if __name__ == '__main__': unittest.main()