Skip to content

Commit c92eaea

Browse files
committed
Passing test on mock
1 parent b039655 commit c92eaea

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/mock_vws/_mock_web_services_api.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import random
1212
import statistics
1313
import uuid
14-
from typing import Callable, Dict, List, Optional, Set, Tuple, Union
14+
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
1515

1616
import pytz
1717
import wrapt
@@ -49,6 +49,29 @@
4949
)
5050

5151

52+
@wrapt.decorator
53+
def update_request_count(
54+
wrapped: Callable[..., str],
55+
instance: Any,
56+
args: Tuple[_RequestObjectProxy, _Context],
57+
kwargs: Dict,
58+
) -> str:
59+
"""
60+
Add to the request count.
61+
62+
Args:
63+
wrapped: An endpoint function for `requests_mock`.
64+
instance: The class that the endpoint function is in.
65+
args: The arguments given to the endpoint function.
66+
kwargs: The keyword arguments given to the endpoint function.
67+
68+
Returns:
69+
The result of calling the endpoint.
70+
"""
71+
instance.request_count += 1
72+
return wrapped(*args, **kwargs)
73+
74+
5275
@wrapt.decorator
5376
def parse_target_id(
5477
wrapped: Callable[..., str],

0 commit comments

Comments
 (0)