Skip to content

Commit

Permalink
ref: refactored the function name, removed pytest.fixture
Browse files Browse the repository at this point in the history
Signed-off-by: HanslettTheDev <[email protected]>
  • Loading branch information
HanslettTheDev committed Oct 28, 2023
1 parent 171ad52 commit 3a62832
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions tests/test_wsfev1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,6 @@

pytestmark =[pytest.mark.vcr, pytest.mark.freeze_time('2021-07-01')]


@pytest.fixture
def mock_client():
mock = Mock()

mock_response = {
"FEParamGetActividadesResult": {
"ResultGet": [
{
"ActividadesTipo": {
"Id": 1,
"Orden": 10,
"Desc": "Activity 1",
}
},
{
"ActividadesTipo": {
"Id": 2,
"Orden": 20,
"Desc": "Activity 2",
}
},
]
}
}

mock.FEParamGetActividades.return_value = mock_response

return mock

def test_dummy(auth):
wsfev1 = auth
wsfev1.Dummy()
Expand Down Expand Up @@ -260,12 +230,41 @@ def test_agregar_actividad():
assert wsfev1.factura["actividades"][0]["actividad_id"] == 960990


def test_param_get_actividades(mock_client):
def test_param_get_actividades():
"""Test the response values from activity code from the web service"""
def simulate_wsfev1_client():
mock = Mock()

mock_response = {
"FEParamGetActividadesResult": {
"ResultGet": [
{
"ActividadesTipo": {
"Id": 1,
"Orden": 10,
"Desc": "Activity 1",
}
},
{
"ActividadesTipo": {
"Id": 2,
"Orden": 20,
"Desc": "Activity 2",
}
},
]
}
}

mock.FEParamGetActividades.return_value = mock_response

return mock


wsfev1 = WSFEv1()
wsfev1.Cuit = "sdfsdf"
wsfev1.client = mock_client

wsfev1.client = simulate_wsfev1_client()
# call the ParamGetActividades where the client
# will be instantiated by the mock
items = wsfev1.ParamGetActividades()
Expand Down

0 comments on commit 3a62832

Please sign in to comment.