Skip to content

Commit

Permalink
Merge pull request #20 from LiadOz/liadoz/cookies_fix
Browse files Browse the repository at this point in the history
fix: ensure compatability with werkzeug 3.0.0
  • Loading branch information
vmalloc authored Jul 11, 2024
2 parents a0eb9fe + 2736149 commit 5bd076e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
# manually triggered

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[testing]"
- name: Test with pytest
run: pytest
5 changes: 1 addition & 4 deletions flask_loopback/flask_loopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FlaskLoopback(object):
def __init__(self, flask_app):
super(FlaskLoopback, self).__init__()
self.flask_app = flask_app
self._test_client = flask_app.test_client()
self._test_client = flask_app.test_client(use_cookies=False)
self._request_context_handlers = []
self._registered_addresses = set()
self._use_ssl = {}
Expand Down Expand Up @@ -101,9 +101,6 @@ def handle_request(self, session, url, request):
except CustomHTTPResponse as e:
return e.response

self._test_client.cookie_jar.clear()
for cookie in request._cookies: # pylint: disable=protected-access
self._test_client.cookie_jar.set_cookie(cookie)
resp = self._test_client.open(path, **open_kwargs)
returned = requests.Response()
assert returned.url is None
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
requests
Flask
six
URLObject
werkzeug>=1.0.0

unittest2; python_version<'2.7'
contextlib2; python_version<'3.3'
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[metadata]
name = Flask-Loopback
classifiers =
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
summary = Library for faking HTTP requests using flask applications without actual network operations
description-file =
README.md
Expand Down

0 comments on commit 5bd076e

Please sign in to comment.