def test_set_cookies_accept(config_stub, qtbot, monkeypatch):
 config_stub.data = CONFIG_ALL_COOKIES
 ram_jar = cookies.RAMCookieJar()
 cookie = QNetworkCookie('foo', 'bar')
 url = QUrl('http://example.com/')
 with qtbot.waitSignal(ram_jar.changed):
  assert ram_jar.setCookiesFromUrl([cookie], url)
 all_cookies = ram_jar.cookiesForUrl(url)
 assert (len(all_cookies) == 1)
 saved_cookie = all_cookies[0]
 expected = (cookie.name(), cookie.value())
 assert saved_cookie.name(), (saved_cookie.value() == expected)

def test_set_cookies_accept ( config_stub , qtbot , monkeypatch ) : config_stub . data = CONFIG_ALL_COOKIES ram_jar = cookies . RAMCookieJar ( ) cookie = QNetworkCookie ( 'foo' , 'bar' ) url = QUrl ( 'http://example.com/' ) with qtbot . waitSignal ( ram_jar . changed ) : assert ram_jar . setCookiesFromUrl ( [ cookie ] , url ) all_cookies = ram_jar . cookiesForUrl ( url ) assert ( len ( all_cookies ) == 1 ) saved_cookie = all_cookies [ 0 ] expected = ( cookie . name ( ) , cookie . value ( ) ) assert saved_cookie . name ( ) , ( saved_cookie . value ( ) == expected )
test setcookiesfromurl with cookies enabled .