-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
matthieu.saison
committed
Sep 11, 2023
1 parent
cc07cce
commit 69e6a6f
Showing
3 changed files
with
14 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../shopinvader_api_lead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": "[email protected]" | ||
"email": "[email protected]", | ||
} | ||
) | ||
|
||
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": "[email protected]", | ||
} | ||
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, | ||
|