@pytest.mark.parametrize('store_cookies,empty', [(True, False), (False, True)])
def test_cookies_changed(config_stub, fake_save_manager, monkeypatch, qtbot, store_cookies, empty):
 config_stub.data = CONFIG_COOKIES_ENABLED
 monkeypatch.setattr(lineparser, 'LineParser', LineparserSaveStub)
 jar = cookies.CookieJar()
 jar._lineparser.data = [COOKIE1, COOKIE2]
 jar.parse_cookies()
 config_stub.set('content', 'cookies-store', store_cookies)
 if empty:
  assert (not jar._lineparser.data)
  assert (not jar._lineparser.saved)
 else:
  assert jar._lineparser.data

@ pytest . mark . parametrize ( 'store_cookies,empty' , [ ( True , False ) , ( False , True ) ] ) def test_cookies_changed ( config_stub , fake_save_manager , monkeypatch , qtbot , store_cookies , empty ) : config_stub . data = CONFIG_COOKIES_ENABLED monkeypatch . setattr ( lineparser , 'LineParser' , LineparserSaveStub ) jar = cookies . CookieJar ( ) jar . _lineparser . data = [ COOKIE1 , COOKIE2 ] jar . parse_cookies ( ) config_stub . set ( 'content' , 'cookies-store' , store_cookies ) if empty : assert ( not jar . _lineparser . data ) assert ( not jar . _lineparser . saved ) else : assert jar . _lineparser . data
test that cookies are saved correctly .