From 7d2efa5a5652c8e1108de61f12b84e46c1388216 Mon Sep 17 00:00:00 2001 From: "@SomBorja" <borja.gimeno@somconnexio.coop> Date: Tue, 31 May 2022 17:35:08 +0200 Subject: [PATCH] fixing pipeline expected 2 blank lines and breaking with test --- odoo_somconnexio_python_client/resources/sponsees.py | 8 +++----- tests/resources/test_sponsees.py | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/odoo_somconnexio_python_client/resources/sponsees.py b/odoo_somconnexio_python_client/resources/sponsees.py index a4a9ff7..e364c0c 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 06eae99..c023313 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" -- GitLab