Added assertion to make sure there are no duplicate sessions
This commit is contained in:
parent
99117cbd82
commit
fa90875ad0
1 changed files with 6 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ import requests
|
|||
from classes.boardgame import BoardGame, BoardGameExpansion
|
||||
import auth_manager
|
||||
|
||||
authenticated_session: requests.Session
|
||||
authenticated_session: requests.Session = requests.Session()
|
||||
|
||||
def url_to_xml_object(url: HttpUrl) -> ET.Element:
|
||||
r = authenticated_session.get(url)
|
||||
|
|
@ -74,10 +74,13 @@ def load_authenticated_bgg_session(username: str, password: str) -> requests.Ses
|
|||
}
|
||||
}
|
||||
|
||||
authenticated_session = requests.Session()
|
||||
|
||||
assert len(authenticated_session.cookies) == 0, 'Session already exists'
|
||||
|
||||
login_response = authenticated_session.post(login_url, json=post_data)
|
||||
|
||||
assert login_response.status_code == 204
|
||||
assert login_response.status_code == 204, "Login failed!"
|
||||
|
||||
|
||||
|
||||
load_authenticated_bgg_session(auth_manager.username, auth_manager.password)
|
||||
Loading…
Reference in a new issue