def test_base_cookie_storage_persist_session_without_changing_the_session_key():
    storage = DummyCookieStorage()
    request = Request()
    request.cookies = {"session-id": {"value": ["test"]}}
    response = Response()
    response.cookies = {}
    storage.persist_session_key(request, response, _SessionKey(100))
    assert response.cookies['session-id']['value'] == 100

    request.cookies = response.cookies
    response.cookies = {}
    storage.persist_session_key(request, response, _SessionKey(100))
    assert response.cookies == {}
def test_base_cookie_storage_persist_session_with_cookies():
    storage = DummyCookieStorage()
    request = Request()
    response = Response()
    response.cookies = {}
    storage.persist_session_key(request, response, _SessionKey(100))
    assert response.cookies['session-id']['value'] == 100