Skip to content

Commit 5bd076e

Browse files
authored
Merge pull request #20 from LiadOz/liadoz/cookies_fix
fix: ensure compatability with werkzeug 3.0.0
2 parents a0eb9fe + 2736149 commit 5bd076e

4 files changed

Lines changed: 35 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
# manually triggered
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install ".[testing]"
27+
- name: Test with pytest
28+
run: pytest

flask_loopback/flask_loopback.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FlaskLoopback(object):
5353
def __init__(self, flask_app):
5454
super(FlaskLoopback, self).__init__()
5555
self.flask_app = flask_app
56-
self._test_client = flask_app.test_client()
56+
self._test_client = flask_app.test_client(use_cookies=False)
5757
self._request_context_handlers = []
5858
self._registered_addresses = set()
5959
self._use_ssl = {}
@@ -101,9 +101,6 @@ def handle_request(self, session, url, request):
101101
except CustomHTTPResponse as e:
102102
return e.response
103103

104-
self._test_client.cookie_jar.clear()
105-
for cookie in request._cookies: # pylint: disable=protected-access
106-
self._test_client.cookie_jar.set_cookie(cookie)
107104
resp = self._test_client.open(path, **open_kwargs)
108105
returned = requests.Response()
109106
assert returned.url is None

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
requests
22
Flask
3+
six
34
URLObject
5+
werkzeug>=1.0.0
46

57
unittest2; python_version<'2.7'
68
contextlib2; python_version<'3.3'

setup.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[metadata]
22
name = Flask-Loopback
33
classifiers =
4-
Programming Language :: Python :: 2.7
5-
Programming Language :: Python :: 3.5
6-
Programming Language :: Python :: 3.6
7-
Programming Language :: Python :: 3.7
4+
Programming Language :: Python :: 3.8
5+
Programming Language :: Python :: 3.9
6+
Programming Language :: Python :: 3.10
7+
Programming Language :: Python :: 3.11
88
summary = Library for faking HTTP requests using flask applications without actual network operations
99
description-file =
1010
README.md

0 commit comments

Comments
 (0)