Skip to content

Commit

Permalink
Bump werkzeug from 2.2.3 to 2.3.7 (#1186)
Browse files Browse the repository at this point in the history
* Bump werkzeug from 2.2.3 to 2.3.7

Bumps [werkzeug](https://github.com/pallets/werkzeug) from 2.2.3 to 2.3.7.
- [Release notes](https://github.com/pallets/werkzeug/releases)
- [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst)
- [Commits](pallets/werkzeug@2.2.3...2.3.7)

---
updated-dependencies:
- dependency-name: werkzeug
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix compatibility with flask/werkzeug 2.3.x

* Update all requirements

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: francisco souza <[email protected]>
  • Loading branch information
dependabot[bot] and fsouza committed Aug 16, 2023
1 parent 8d01c36 commit 0aac65f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask==2.2.3
werkzeug==2.2.3
Flask==2.3.2
werkzeug==2.3.7
coverage==7.3.0
argparse
Django>=2.0.6
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_version_data() -> dict:
extras_require={
"zope.testbrowser": ["zope.testbrowser>=6.0", "lxml>=4.2.4", "cssselect"],
"django": ["Django>=2.0.6", "lxml>=4.2.4", "cssselect"],
"flask": ["Flask>=2.0.2", "lxml>=4.2.4", "cssselect"],
"flask": ["Flask>=2.3.2", "lxml>=4.2.4", "cssselect"],
"selenium": ["selenium>=4.1.0,<4.5.0"],
},
tests_require=["coverage", "flask"],
Expand Down
23 changes: 12 additions & 11 deletions splinter/driver/flaskclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,42 @@
class CookieManager(CookieManagerAPI):
def add(self, cookie, **kwargs):
for key, value in cookie.items():
kwargs["server_name"] = "localhost"
kwargs["key"] = key
kwargs["value"] = value
self.driver.set_cookie(**kwargs)
self.driver.set_cookie(
key=key,
value=value,
domain="localhost",
**kwargs,
)

def delete(self, *cookies):
if cookies:
for cookie in cookies:
try:
self.driver.delete_cookie("localhost", cookie)
self.driver.delete_cookie(cookie)
except KeyError:
pass

def delete_all(self):
self.driver.cookie_jar.clear()
self.driver._cookies.clear()

def all(self, verbose=False): # NOQA: A003
cookies = {}
for cookie in self.driver.cookie_jar:
cookies[cookie.name] = cookie.value
cookies[cookie.key] = cookie.value
return cookies

def __getitem__(self, item):
cookies = {c.name: c for c in self.driver.cookie_jar}
return cookies[item].value
return self.driver.get_cookie(item).value

def __contains__(self, key):
for cookie in self.driver.cookie_jar:
if cookie.name == key:
if cookie.key == key:
return True
return False

def __eq__(self, other_object):
if isinstance(other_object, dict):
cookies_dict = {c.name: c.value for c in self.driver.cookie_jar}
cookies_dict = {c.key: c.value for c in self.driver.cookie_jar}
return cookies_dict == other_object
return False

Expand Down
4 changes: 2 additions & 2 deletions tests/test_flaskclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def test_cookies_extra_parameters(self):
"""Cookie can be created with extra parameters."""
timestamp = int(time.time() + 120)
self.browser.cookies.add({"sha": "zam"}, expires=timestamp)
cookie = {c.name: c for c in self.browser._browser.cookie_jar}["sha"]
assert timestamp == cookie.expires
cookie = {c.key: c for c in self.browser._browser.cookie_jar}["sha"]
assert timestamp == int(cookie.expires.timestamp())


class FlaskClientDriverTestWithCustomHeaders(unittest.TestCase):
Expand Down

0 comments on commit 0aac65f

Please sign in to comment.