diff options
author | David Robertson <davidr@element.io> | 2022-06-11 19:45:35 +0100 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2022-06-11 19:45:35 +0100 |
commit | 395d624e120643d51fd4693346bafce40fe6a48a (patch) | |
tree | 00816f39c402b59737df0153dbc064b733a83c1f | |
parent | Introduce a Looper type (diff) | |
download | synapse-395d624e120643d51fd4693346bafce40fe6a48a.tar.xz |
Suppress checking of a mock
-rw-r--r-- | tests/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/utils.py b/tests/utils.py index d3da559200..abdc0eaadd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -221,10 +221,15 @@ def default_config( return config_dict -def mock_getRawHeaders(headers=None): +def mock_getRawHeaders(headers=None): # type: ignore[no-untyped-def] headers = headers if headers is not None else {} - def getRawHeaders(name, default=None): + def getRawHeaders(name, default=None): # type: ignore[no-untyped-def] + # If the requested header is present, the real twisted function returns + # List[str] if name is a str and List[bytes] if name is a bytes. + # This mock doesn't support that behaviour. + # Fortunately, none of the current callers of mock_getRawHeaders() provide a + # headers dict, so we don't encounter this discrepancy in practice. return headers.get(name, default) return getRawHeaders |