Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed rest api addons and their deps #219

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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$|
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- prettier-ignore-end -->
Expand Down
1 change: 0 additions & 1 deletion g2p_payment_files/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
from . import models
from . import tests
4 changes: 2 additions & 2 deletions g2p_payment_files/tests/test_fastapi_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand All @@ -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()
4 changes: 2 additions & 2 deletions g2p_payment_files/tests/test_file_qrcode_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down Expand Up @@ -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(
{
Expand Down
6 changes: 2 additions & 4 deletions g2p_payment_files/tests/test_payment_file_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -18,9 +18,7 @@ def setUp(self):
"body_string": "<p>Sample Body</p>",
}
)
MailTemplate._render_template = MagicMock(
return_value={1: "<p>Rendered HTML</p>"}
)
MailTemplate._render_template = MagicMock(return_value={1: "<p>Rendered HTML</p>"})

def mock_add_file(self, file_content, extension):
return {
Expand Down
30 changes: 8 additions & 22 deletions g2p_payment_files/tests/test_payment_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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")
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion g2p_program_registrant_info_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"demo": [],
"images": [],
"application": False,
"installable": True,
"installable": False,
"auto_install": False,
}
2 changes: 1 addition & 1 deletion g2p_programs_rest_api/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"demo": [],
"images": [],
"application": False,
"installable": True,
"installable": False,
"auto_install": False,
}
13 changes: 12 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
git+https://github.com/OpenG2P/[email protected]#subdirectory=storage_backend
git+https://github.com/OpenG2P/[email protected]#subdirectory=storage_backend_s3
git+https://github.com/OpenG2P/[email protected]#subdirectory=storage_file
git+https://github.com/OpenG2P/[email protected]#subdirectory=fastapi
git+https://github.com/OpenG2P/[email protected]#subdirectory=extendable
git+https://github.com/OpenG2P/[email protected]#subdirectory=extendable_fastapi
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_base
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_individual
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_group
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_membership
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_bank
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_rest_api
# git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_registry_rest_api
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_documents
git+https://github.com/OpenG2P/[email protected]#subdirectory=g2p_encryption
git+https://github.com/openspp/[email protected]#subdirectory=spp_area
git+https://github.com/openspp/[email protected]#subdirectory=spp_service_points
git+https://github.com/openspp/[email protected]#subdirectory=spp_programs
git+https://github.com/openspp/[email protected]#subdirectory=g2p_entitlement_cash
git+https://github.com/openspp/[email protected]#subdirectory=spp_entitlement_in_kind
Loading