@@ -140,27 +140,24 @@ def hits(app):
140140
141141
142142@pytest .mark .parametrize (
143- "expect_ok " ,
143+ "path,expected_hits_diff " ,
144144 [
145- (
146- [
147- ("/backpath2/backpath21/backpath22/path1/1234" , 3 ),
148- ("/backpath2/backpath21/backpath22/path1" , 2 ),
149- ("/backpath2/backpath21/backpath22/" , 1 ),
150- ("/backpath2/backpath21/path1/1234" , 3 ),
151- ("/backpath2/backpath21/path1" , 2 ),
152- ("/backpath2/backpath21/" , 1 ),
153- ("/backpath2/path1/1234" , 3 ),
154- ("/backpath2/path1" , 2 ),
155- ("/backpath2/" , 1 ),
156- ("/backpath1/path1/bar/1234" , 1 ),
157- ("/backpath1/path1/bar" , 1 ),
158- ]
159- )
145+ ("/backpath1/path1/bar/1234" , 1 ),
146+ ("/backpath1/path1/bar" , 1 ),
147+ ("/backpath2/backpath21/backpath22/path1/1234" , 3 ),
148+ ("/backpath2/backpath21/backpath22/path1" , 2 ),
149+ ("/backpath2/backpath21/backpath22/" , 1 ),
150+ ("/backpath2/backpath21/path1/1234" , 3 ),
151+ ("/backpath2/backpath21/path1" , 2 ),
152+ ("/backpath2/backpath21/" , 1 ),
153+ ("/backpath2/path1/1234" , 3 ),
154+ ("/backpath2/path1" , 2 ),
155+ ("/backpath2/" , 1 ),
160156 ],
161157)
162158# pylint: disable=unused-argument
163- def test (application , client , backend_usages , backends , expect_ok ):
159+ @pytest .mark .usefixtures ("backend_usages" , "backends" )
160+ def test (application , client , path , expected_hits_diff ):
164161 """
165162 Make requests against all backends and mappings
166163 Assert that these requests return 200
@@ -173,13 +170,12 @@ def test(application, client, backend_usages, backends, expect_ok):
173170 # it will be also possible to check the hits at the backend level
174171 # right now is by hits only tested if the 'last' flag in mapping at
175172 # the backend level works correctly
176- for path , expected_hits_diff in expect_ok :
177- hits_before = hits (application )
173+ hits_before = hits (application )
178174
179- response = client .get (path )
180- assert response .status_code == 200 , f"For path { path } expected status_code 200"
175+ response = client .get (path )
176+ assert response .status_code == 200 , f"For path { path } expected status_code 200"
181177
182- hits_after = resilient .analytics_list_by_service (
183- application .threescale_client , application ["service_id" ], "hits" , "total" , hits_before + expected_hits_diff
184- )
185- assert hits_after == hits_before + expected_hits_diff , f"For { path } expected different number of hits"
178+ hits_after = resilient .analytics_list_by_service (
179+ application .threescale_client , application ["service_id" ], "hits" , "total" , hits_before + expected_hits_diff
180+ )
181+ assert hits_after == hits_before + expected_hits_diff , f"For { path } expected different number of hits"
0 commit comments