diff --git a/setup/shopinvader_api_lead/odoo/addons/shopinvader_api_lead b/setup/shopinvader_api_lead/odoo/addons/shopinvader_api_lead new file mode 120000 index 0000000000..f1369af6e2 --- /dev/null +++ b/setup/shopinvader_api_lead/odoo/addons/shopinvader_api_lead @@ -0,0 +1 @@ +../../../../shopinvader_api_lead \ No newline at end of file diff --git a/setup/shopinvader_api_lead/setup.py b/setup/shopinvader_api_lead/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/shopinvader_api_lead/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shopinvader_api_lead/tests/test_shopinvader_lead.py b/shopinvader_api_lead/tests/test_shopinvader_lead.py index 8a598cd620..e0292a8898 100644 --- a/shopinvader_api_lead/tests/test_shopinvader_lead.py +++ b/shopinvader_api_lead/tests/test_shopinvader_lead.py @@ -7,13 +7,14 @@ from fastapi import status from requests import Response -from odoo.tests.common import tagged from odoo import models +from odoo.tests.common import tagged from odoo.addons.extendable_fastapi.tests.common import FastAPITransactionCase from ..routers.lead import leads_router + @tagged("post_install", "-at_install") class TestShopinvaderLeadsApi(FastAPITransactionCase): @classmethod @@ -27,10 +28,10 @@ def setUpClass(cls) -> None: "zip": "1410", "city": "Waterloo", "country_id": cls.env.ref("base.be").id, - "email": "osiris@shopinvader.com" + "email": "osiris@shopinvader.com", } ) - + cls.default_fastapi_authenticated_partner = cls.env["res.partner"] cls.default_fastapi_router = leads_router def test_create_lead(self): @@ -53,11 +54,8 @@ def test_create_lead(self): "email_from": check_data.pop("email"), } ) - import pdb; pdb.set_trace() with self._create_test_client() as test_client: - response: Response = test_client.post( - "/leads", content=json.dumps(data) - ) + response: Response = test_client.post("/leads", content=json.dumps(data)) self.assertEqual( response.status_code, status.HTTP_201_CREATED, @@ -74,17 +72,14 @@ def test_create_lead(self): # self._check_notification("lead_confirmation", lead) def test_create_lead_with_logged_partner(self): - self.default_fastapi_authenticated_partner = self.test_partner data = { "name": "Besoin d'un nouveau site", "description": "Help, on ne supporte plus magento", "email": "bliblablo@example.org", } - with self._create_test_client() as test_client: - response: Response = test_client.post( - "/leads", content=json.dumps(data) - ) + with self._create_test_client(partner=self.test_partner) as test_client: + response: Response = test_client.post("/leads", content=json.dumps(data)) self.assertEqual( response.status_code, status.HTTP_201_CREATED,