@@ -276,3 +276,62 @@ def get_issues(self):
276276 ("github" , "packit" ): 2 ,
277277 ("github" , "rpms" ): 1 ,
278278 }
279+
280+ def test_decorator_pagure_appends_repo_to_namespace (self ):
281+ """Test that Pagure decorator appends repo name to namespace."""
282+ tracker = get_metrics_tracker ()
283+ tracker .reset ()
284+
285+ # Create mock Pagure project with namespace and repo
286+ mock_project = flexmock (namespace = "rpms" , repo = "python-requests" )
287+
288+ @track_ogr_request ("pagure" )
289+ def test_method (self ):
290+ return "success"
291+
292+ result = test_method (mock_project )
293+
294+ assert result == "success"
295+
296+ counts = tracker .get_all_counts ()
297+ assert counts == {("pagure" , "rpms/python-requests" ): 1 }
298+
299+ def test_decorator_pagure_without_repo (self ):
300+ """Test Pagure decorator when repo attribute is missing."""
301+ tracker = get_metrics_tracker ()
302+ tracker .reset ()
303+
304+ # Create mock Pagure project with only namespace
305+ mock_project = flexmock (namespace = "rpms" )
306+
307+ @track_ogr_request ("pagure" )
308+ def test_method (self ):
309+ return "success"
310+
311+ result = test_method (mock_project )
312+
313+ assert result == "success"
314+
315+ # Should fall back to just namespace when repo is missing
316+ counts = tracker .get_all_counts ()
317+ assert counts == {("pagure" , "rpms" ): 1 }
318+
319+ def test_decorator_non_pagure_does_not_append_repo (self ):
320+ """Test that non-Pagure services don't append repo to namespace."""
321+ tracker = get_metrics_tracker ()
322+ tracker .reset ()
323+
324+ # Create mock project with both namespace and repo
325+ mock_project = flexmock (namespace = "packit" , repo = "some-repo" )
326+
327+ @track_ogr_request ("github" )
328+ def test_method (self ):
329+ return "success"
330+
331+ result = test_method (mock_project )
332+
333+ assert result == "success"
334+
335+ # For non-Pagure services, repo should be ignored
336+ counts = tracker .get_all_counts ()
337+ assert counts == {("github" , "packit" ): 1 }
0 commit comments