core - fix sessions tests

This commit is contained in:
Théophile Diot 2023-05-16 11:23:56 -04:00
parent ab54b18e05
commit 36fdec1058
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
1 changed files with 6 additions and 5 deletions

View File

@ -3,9 +3,7 @@ from os import getenv
from requests import get, post
from requests.exceptions import RequestException
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
from selenium.common.exceptions import NoSuchElementException
from time import sleep
from traceback import format_exc
@ -72,7 +70,7 @@ try:
print("❌ An error occurred when restarting BunkerWeb, exiting ...", flush=True)
exit(1)
sleep(10)
sleep(5)
print(" Starting Firefox again ...", flush=True)
with webdriver.Firefox(options=firefox_options) as driver:
@ -84,8 +82,11 @@ try:
cookie = driver.get_cookies()[0]
if sessions_name == "random" and first_cookie["name"] == cookie["name"]:
print("❌ The cookie name has not been changed, exiting ...", flush=True)
if sessions_name == "random" and first_cookie["name"] != cookie["name"]:
print(
"❌ The cookie name shouldn't have changed after a simple reload, exiting ...",
flush=True,
)
exit(1)
except SystemExit as e:
exit(e.code)