Skip to content

Commit 3a62832

Browse files
ref: refactored the function name, removed pytest.fixture
Signed-off-by: HanslettTheDev <HanslettTheDev@gmail.com>
1 parent 171ad52 commit 3a62832

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

tests/test_wsfev1.py

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,6 @@
4040

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

43-
44-
@pytest.fixture
45-
def mock_client():
46-
mock = Mock()
47-
48-
mock_response = {
49-
"FEParamGetActividadesResult": {
50-
"ResultGet": [
51-
{
52-
"ActividadesTipo": {
53-
"Id": 1,
54-
"Orden": 10,
55-
"Desc": "Activity 1",
56-
}
57-
},
58-
{
59-
"ActividadesTipo": {
60-
"Id": 2,
61-
"Orden": 20,
62-
"Desc": "Activity 2",
63-
}
64-
},
65-
]
66-
}
67-
}
68-
69-
mock.FEParamGetActividades.return_value = mock_response
70-
71-
return mock
72-
7343
def test_dummy(auth):
7444
wsfev1 = auth
7545
wsfev1.Dummy()
@@ -260,12 +230,41 @@ def test_agregar_actividad():
260230
assert wsfev1.factura["actividades"][0]["actividad_id"] == 960990
261231

262232

263-
def test_param_get_actividades(mock_client):
233+
def test_param_get_actividades():
264234
"""Test the response values from activity code from the web service"""
235+
def simulate_wsfev1_client():
236+
mock = Mock()
237+
238+
mock_response = {
239+
"FEParamGetActividadesResult": {
240+
"ResultGet": [
241+
{
242+
"ActividadesTipo": {
243+
"Id": 1,
244+
"Orden": 10,
245+
"Desc": "Activity 1",
246+
}
247+
},
248+
{
249+
"ActividadesTipo": {
250+
"Id": 2,
251+
"Orden": 20,
252+
"Desc": "Activity 2",
253+
}
254+
},
255+
]
256+
}
257+
}
258+
259+
mock.FEParamGetActividades.return_value = mock_response
260+
261+
return mock
262+
263+
265264
wsfev1 = WSFEv1()
266265
wsfev1.Cuit = "sdfsdf"
267-
wsfev1.client = mock_client
268-
266+
wsfev1.client = simulate_wsfev1_client()
267+
269268
# call the ParamGetActividades where the client
270269
# will be instantiated by the mock
271270
items = wsfev1.ParamGetActividades()

0 commit comments

Comments
 (0)