Skip to content
Snippets Groups Projects
Commit e67f928a authored by Borja Gimeno's avatar Borja Gimeno
Browse files

test: ContractTest & FiberContractsToPackTests

parent 5458f5ba
No related branches found
No related tags found
1 merge request!64Feature/contract catalog pack pagination
...@@ -6,7 +6,6 @@ import unittest2 as unittest ...@@ -6,7 +6,6 @@ import unittest2 as unittest
from odoo_somconnexio_python_client.exceptions import ResourceNotFound from odoo_somconnexio_python_client.exceptions import ResourceNotFound
from odoo_somconnexio_python_client.resources.contract import ( from odoo_somconnexio_python_client.resources.contract import (
Contract, Contract,
FiberContractsToPack,
) )
...@@ -61,14 +60,27 @@ class ContractTests(unittest.TestCase): ...@@ -61,14 +60,27 @@ class ContractTests(unittest.TestCase):
assert contract.phone_number == "676858494" assert contract.phone_number == "676858494"
assert contract.current_tariff_product == "SE_SC_REC_MOBILE_T_150_1024" assert contract.current_tariff_product == "SE_SC_REC_MOBILE_T_150_1024"
class FiberContractsToPackTests(unittest.TestCase):
@pytest.mark.vcr() @pytest.mark.vcr()
def test_search_by_partner_ref(self): def test_search_contract_by_customer_ref(self):
contracts = FiberContractsToPack.search_by_partner_ref(partner_ref="1234") contracts = Contract.search_by_customer_ref(customer_ref="123")
contract = contracts[0] contract = contracts[0]
assert contract.code == "6758" assert contract.customer_ref == "123"
assert contract.customer_vat == "ES55642302N" assert contract.customer_vat == "ES55642302N"
assert contract.phone_number == "999666888" assert contract.phone_number == "879786754"
assert contract.current_tariff_product == "SE_SC_REC_BA_F_100" assert contract.current_tariff_product == "SE_SC_REC_BA_F_100"
@pytest.mark.vcr()
def test_search_paginated_contract_by_customer_ref(self):
paging_contracts = Contract.paginated_search_by_customer_ref(
customer_ref="123", limit="5", offset="0"
)
contract = paging_contracts.contracts[1]
paging = paging_contracts.paging
assert contract.customer_ref == "123"
assert contract.customer_vat == "ES55642302N"
assert contract.phone_number == "676858494"
assert contract.current_tariff_product == "SE_SC_REC_MOBILE_T_150_1024"
assert paging.limit == 5
assert paging.total_number_records == 5
import pytest
import unittest2 as unittest
from odoo_somconnexio_python_client.exceptions import ResourceNotFound
from odoo_somconnexio_python_client.resources.fiber_contracts import (
FiberContractsToPack,
)
@pytest.fixture(scope="module")
def vcr_config():
return {
# Replace the API-KEY request header with "DUMMY" in cassettes
"filter_headers": [("API-KEY", "DUMMY")],
}
class FiberContractsToPackTests(unittest.TestCase):
@pytest.mark.vcr()
def test_search_by_partner_ref(self):
contracts = FiberContractsToPack.search_by_partner_ref(partner_ref=123)
contract = contracts[0]
assert contract.code == "123"
assert contract.customer_vat == "ES74765579P"
assert contract.phone_number == "957909026"
assert contract.current_tariff_product == "SE_SC_REC_BA_F_100_SF"
@pytest.mark.vcr()
def test_search_resource_not_found(self):
self.assertRaises(
ResourceNotFound,
FiberContractsToPack.search_by_partner_ref,
partner_ref="xxx",
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment