Skip to content
Myr

test different CookieJar types for add_dict_to_cookiejar

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nate Prewitt · committed by Nate Prewitt · parent dfd85f2 · Browse files · 1 file+17 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−1 removed

  • tests:+17 added−1 removed

1 file+17 added−1 removed

modified:tests/test_utils.py+17 added-1 removed
2 unmodified lines
3from io import BytesIO45import pytest6from requests import compat7from requests.cookies import RequestsCookieJar, cookiejar_from_dict8from requests.structures import CaseInsensitiveDict9from requests.utils import (10 address_in_network, dotted_netmask,11 get_auth_from_url, get_encoding_from_headers,
3 unmodified lines
15 parse_header_links, prepend_scheme_if_needed,16 requote_uri, select_proxy, should_bypass_proxies, super_len,17 to_key_val_list, to_native_string,18 unquote_header_value, unquote_unreserved,18 urldefragauth)19 urldefragauth, add_dict_to_cookiejar)2021from .compat import StringIO, cStringIO2223
477 unmodified lines
501 """502 monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')503 monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')504 assert should_bypass_proxies(url) == expected505506@pytest.mark.parametrize(507 'cookiejar', (508 compat.cookielib.CookieJar(),509 RequestsCookieJar()510 ))511def test_add_dict_to_cookiejar(cookiejar):512 """Ensure add_dict_to_cookiejar works for513 non-RequestsCookieJar CookieJars514 """515 cookiedict = {'test': 'cookies',516 'good': 'cookies'}517 cj = add_dict_to_cookiejar(cookiejar, cookiedict)518 cookies = dict((cookie.name, cookie.value) for cookie in cj)519 assert cookiedict == cookies