From 370e97b3bce19c930d3a77860af51194a9ce38bb Mon Sep 17 00:00:00 2001 From: Lalith Kota Date: Mon, 1 Apr 2024 17:30:30 +0530 Subject: [PATCH 1/3] Removed rest api addons and their deps Signed-off-by: Lalith Kota --- .pre-commit-config.yaml | 2 ++ README.md | 10 +++++-- g2p_payment_files/__init__.py | 1 - .../tests/test_fastapi_endpoint.py | 4 +-- .../tests/test_file_qrcode_config.py | 4 +-- .../tests/test_payment_file_config.py | 6 ++-- .../tests/test_payment_manager.py | 30 +++++-------------- .../__manifest__.py | 2 +- g2p_programs_rest_api/__manifest__.py | 2 +- test-requirements.txt | 5 +++- 10 files changed, 30 insertions(+), 36 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7f5664e1..3e573ba8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,8 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS + ^g2p_program_registrant_info_rest_api/| + ^g2p_programs_rest_api/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops ^setup/|/static/description/index\.html$| diff --git a/README.md b/README.md index ef694ff4..cf390358 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,18 @@ addon | version | maintainers | summary [g2p_program_cycleless](g2p_program_cycleless/) | 17.0.1.0.0 | | OpenG2P Programs: Cycleless [g2p_program_documents](g2p_program_documents/) | 17.0.1.0.0 | | OpenG2P Program: Documents [g2p_program_registrant_info](g2p_program_registrant_info/) | 17.0.1.0.0 | | G2P Program: Registrant Info -[g2p_program_registrant_info_rest_api](g2p_program_registrant_info_rest_api/) | 17.0.1.0.0 | | G2P Program : Program Registrant Info Rest API [g2p_program_reimbursement](g2p_program_reimbursement/) | 17.0.1.0.0 | | OpenG2P Programs: Reimbursement [g2p_programs](g2p_programs/) | 17.0.1.0.0 | | OpenG2P Programs -[g2p_programs_rest_api](g2p_programs_rest_api/) | 17.0.1.0.0 | | G2P Programs: REST API [g2p_proxy_means_test](g2p_proxy_means_test/) | 17.0.1.0.0 | | G2P: Proxy Means Test + +Unported addons +--------------- +addon | version | maintainers | summary +--- | --- | --- | --- +[g2p_program_registrant_info_rest_api](g2p_program_registrant_info_rest_api/) | 17.0.1.0.0 (unported) | | G2P Program : Program Registrant Info Rest API +[g2p_programs_rest_api](g2p_programs_rest_api/) | 17.0.1.0.0 (unported) | | G2P Programs: REST API + [//]: # (end addons) diff --git a/g2p_payment_files/__init__.py b/g2p_payment_files/__init__.py index 7cfd87fb..2c0aa80c 100644 --- a/g2p_payment_files/__init__.py +++ b/g2p_payment_files/__init__.py @@ -1,3 +1,2 @@ # Part of OpenG2P. See LICENSE file for full copyright and licensing details. from . import models -from . import tests diff --git a/g2p_payment_files/tests/test_fastapi_endpoint.py b/g2p_payment_files/tests/test_fastapi_endpoint.py index 03ea3bf7..84c6b8f6 100644 --- a/g2p_payment_files/tests/test_fastapi_endpoint.py +++ b/g2p_payment_files/tests/test_fastapi_endpoint.py @@ -5,7 +5,7 @@ class TestWellknownComponent(TransactionCase): def setUp(self): - super(TestWellknownComponent, self).setUp() + super().setUp() self.endpoint_model = self.env["fastapi.endpoint"] self.endpoint = self.endpoint_model.create( { @@ -19,5 +19,5 @@ def test_get_fastapi_routers_payment_app(self): with patch( "odoo.addons.g2p_payment_files.models.fastapi_endpoint.api_router", autospec=True, - ) as mock_router: + ): self.endpoint._get_fastapi_routers() diff --git a/g2p_payment_files/tests/test_file_qrcode_config.py b/g2p_payment_files/tests/test_file_qrcode_config.py index 9ef8e858..1497a943 100644 --- a/g2p_payment_files/tests/test_file_qrcode_config.py +++ b/g2p_payment_files/tests/test_file_qrcode_config.py @@ -6,7 +6,7 @@ class TestG2PPaymentFileQRCodeConfig(TransactionCase): def setUp(self): - super(TestG2PPaymentFileQRCodeConfig, self).setUp() + super().setUp() self.QRCodeConfig = self.env["g2p.payment.file.qrcode.config"] self.crypto_key_set = self.env["g2p.crypto.key.set"].create( { @@ -91,7 +91,7 @@ def test_render_data_string(self): class TestG2PPaymentFileQRCode(TransactionCase): def setUp(self): - super(TestG2PPaymentFileQRCode, self).setUp() + super().setUp() self.QRCodeModel = self.env["g2p.payment.file.qrcode"] self.qr_code_config = self.env["g2p.payment.file.qrcode.config"].create( { diff --git a/g2p_payment_files/tests/test_payment_file_config.py b/g2p_payment_files/tests/test_payment_file_config.py index db364806..1e134c7f 100644 --- a/g2p_payment_files/tests/test_payment_file_config.py +++ b/g2p_payment_files/tests/test_payment_file_config.py @@ -8,7 +8,7 @@ class TestG2PPaymentFileConfig(TransactionCase): def setUp(self): - super(TestG2PPaymentFileConfig, self).setUp() + super().setUp() self.document_store = MagicMock() self.document_store.add_file.side_effect = self.mock_add_file self.payment_file_config = self.env["g2p.payment.file.config"].create( @@ -18,9 +18,7 @@ def setUp(self): "body_string": "

Sample Body

", } ) - MailTemplate._render_template = MagicMock( - return_value={1: "

Rendered HTML

"} - ) + MailTemplate._render_template = MagicMock(return_value={1: "

Rendered HTML

"}) def mock_add_file(self, file_content, extension): return { diff --git a/g2p_payment_files/tests/test_payment_manager.py b/g2p_payment_files/tests/test_payment_manager.py index 33311e38..1eee310f 100644 --- a/g2p_payment_files/tests/test_payment_manager.py +++ b/g2p_payment_files/tests/test_payment_manager.py @@ -6,14 +6,10 @@ class TestG2PPaymentManager(TransactionCase): def setUp(self): - super(TestG2PPaymentManager, self).setUp() + super().setUp() self.backend = self.env["storage.backend"].create({"name": "Test Backend"}) - self.crypto_key_set = self.env["g2p.crypto.key.set"].create( - {"name": "Test Crypto Key"} - ) - self.file_config = self.env["g2p.payment.file.config"].create( - {"name": "Test Config"} - ) + self.crypto_key_set = self.env["g2p.crypto.key.set"].create({"name": "Test Crypto Key"}) + self.file_config = self.env["g2p.payment.file.config"].create({"name": "Test Config"}) self.batch_tag = self.env["g2p.payment.batch.tag"].create( { "name": "Test Batch Tag", @@ -40,15 +36,11 @@ def setUp(self): } ) - self.files_payment_manager = self.env[ - "g2p.program.payment.manager.file" - ].create( + self.files_payment_manager = self.env["g2p.program.payment.manager.file"].create( { "name": "Test Files Payment Manager", "file_document_store": self.backend.id, - "crypto_key_set": [ - (0, 0, {"name": "Key Set for File Payment Manager"}) - ], + "crypto_key_set": [(0, 0, {"name": "Key Set for File Payment Manager"})], "batch_tag_ids": [(6, 0, [self.batch_tag.id])], "program_id": self.program.id, "create_batch": True, @@ -62,16 +54,12 @@ def setUp(self): def test_payment_manager_creation(self): self.assertTrue(self.files_payment_manager) - self.assertEqual( - self.files_payment_manager.file_document_store.id, self.backend.id - ) + self.assertEqual(self.files_payment_manager.file_document_store.id, self.backend.id) self.assertEqual(len(self.files_payment_manager.crypto_key_set), 1) self.assertIn(self.batch_tag.id, self.files_payment_manager.batch_tag_ids.ids) def test_prepare_payments_with_batch(self): - payments, batches = self.files_payment_manager._prepare_payments( - self.cycle, self.entitlement - ) + payments, batches = self.files_payment_manager._prepare_payments(self.cycle, self.entitlement) self.assertEqual(len(payments), 1, "Should create one payment") self.assertEqual(len(batches), 1, "Should create one batch") @@ -81,9 +69,7 @@ def test_prepare_payments_with_batch(self): def test_prepare_payments_without_batch(self): self.files_payment_manager.write({"create_batch": False}) - payments, batches = self.files_payment_manager._prepare_payments( - self.cycle, self.entitlement - ) + payments, batches = self.files_payment_manager._prepare_payments(self.cycle, self.entitlement) self.assertEqual(len(payments), 1, "Should create one payment") diff --git a/g2p_program_registrant_info_rest_api/__manifest__.py b/g2p_program_registrant_info_rest_api/__manifest__.py index 6c4567f9..10efd9ac 100644 --- a/g2p_program_registrant_info_rest_api/__manifest__.py +++ b/g2p_program_registrant_info_rest_api/__manifest__.py @@ -16,6 +16,6 @@ "demo": [], "images": [], "application": False, - "installable": True, + "installable": False, "auto_install": False, } diff --git a/g2p_programs_rest_api/__manifest__.py b/g2p_programs_rest_api/__manifest__.py index fbf00f28..aeb8ecaa 100644 --- a/g2p_programs_rest_api/__manifest__.py +++ b/g2p_programs_rest_api/__manifest__.py @@ -16,6 +16,6 @@ "demo": [], "images": [], "application": False, - "installable": True, + "installable": False, "auto_install": False, } diff --git a/test-requirements.txt b/test-requirements.txt index 41b84999..a573a79a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,11 @@ +git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=fastapi +git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=extendable +git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=extendable_fastapi git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_base git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_individual git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_group git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_membership git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_bank -git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_rest_api +# git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_rest_api git+https://github.com/OpenG2P/openg2p-documents@17.0-develop#subdirectory=g2p_documents git+https://github.com/OpenG2P/openg2p-security@17.0-develop#subdirectory=g2p_encryption From e13c0471e7fe7ef4db6b985e2ff2e30703354613 Mon Sep 17 00:00:00 2001 From: Lalith Kota Date: Mon, 1 Apr 2024 20:54:44 +0530 Subject: [PATCH 2/3] Added spp test requirements Signed-off-by: Lalith Kota --- test-requirements.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test-requirements.txt b/test-requirements.txt index a573a79a..c10fcee2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,3 +9,8 @@ git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_ba # git+https://github.com/OpenG2P/openg2p-registry@17.0-develop#subdirectory=g2p_registry_rest_api git+https://github.com/OpenG2P/openg2p-documents@17.0-develop#subdirectory=g2p_documents git+https://github.com/OpenG2P/openg2p-security@17.0-develop#subdirectory=g2p_encryption +git+https://github.com/openspp/openspp-modules@17.0#subdirectory=spp_area +git+https://github.com/openspp/openspp-modules@17.0#subdirectory=spp_service_points +git+https://github.com/openspp/openspp-modules@17.0#subdirectory=spp_programs +git+https://github.com/openspp/openspp-modules@17.0#subdirectory=g2p_entitlement_cash +git+https://github.com/openspp/openspp-modules@17.0#subdirectory=spp_entitlement_in_kind From f2b32c7416061a8b6947851adb289863725f80d6 Mon Sep 17 00:00:00 2001 From: Lalith Kota Date: Mon, 1 Apr 2024 21:00:21 +0530 Subject: [PATCH 3/3] Added storage test requirements Signed-off-by: Lalith Kota --- test-requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-requirements.txt b/test-requirements.txt index c10fcee2..7f5bb8b8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,6 @@ +git+https://github.com/OpenG2P/storage@17.0#subdirectory=storage_backend +git+https://github.com/OpenG2P/storage@17.0#subdirectory=storage_backend_s3 +git+https://github.com/OpenG2P/storage@17.0#subdirectory=storage_file git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=fastapi git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=extendable git+https://github.com/OpenG2P/rest-framework@17.0#subdirectory=extendable_fastapi