diff --git a/odoo_somconnexio_python_client/resources/sponsees.py b/odoo_somconnexio_python_client/resources/sponsees.py index a4a9ff7c5819707982fb792b1a86b28b335eb2b8..e364c0c967797cc46baa38fe16123e74b1ffa696 100644 --- a/odoo_somconnexio_python_client/resources/sponsees.py +++ b/odoo_somconnexio_python_client/resources/sponsees.py @@ -2,6 +2,7 @@ from odoo_somconnexio_python_client.client import Client from ..exceptions import ResourceNotFound + class Sponsees: _url_path = "partner/sponsees" @@ -25,14 +26,11 @@ class Sponsees: :return: sponsees object if exists """ - return cls._get(id=int(ref)) - - @classmethod - def _get(cls, id=None): response_data = Client().get( - "{}/{}".format(cls._url_path, id) + "{}/{}".format(cls._url_path, ref) ) if not response_data: raise ResourceNotFound(resource=cls.__name__, filter={}) return cls(**response_data) + diff --git a/tests/resources/test_sponsees.py b/tests/resources/test_sponsees.py index 06eae995618be54692b88cdc1d54d987ddadde56..c023313b527c0d442c7d97ab88ae244062f3a2c4 100644 --- a/tests/resources/test_sponsees.py +++ b/tests/resources/test_sponsees.py @@ -1,25 +1,25 @@ import unittest - import pytest import unittest2 as unittest from odoo_somconnexio_python_client.resources.sponsees import Sponsees from odoo_somconnexio_python_client.exceptions import ResourceNotFound + class SponseesTest(unittest.TestCase): @pytest.mark.vcr() def test_search_resource_not_found(self): - assert True + assert False # TODO self.assertRaises(ResourceNotFound, Sponsees.get, ref="") @pytest.mark.vcr() def test_get_with_ref(self): ref = "1234" # TODO uncomment: sponsees = Sponsees.get(ref) - assert True + assert False # TODO assert sponsees.sponsorship_code == "XXXX" # TODO assert sponsees.sponsees_max == "X" # TODO assert sponsees.sponsees_number == "X"