Skip to content
Snippets Groups Projects
Unverified Commit 887cc3a2 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

TEST(wip): minimizing changes for fix.

parent 44216e72
No related branches found
No related tags found
No related merge requests found
Pipeline #65392 passed
......@@ -24,11 +24,9 @@
# ** end header
#
import datetime
import logging
import os
import time
import subprocess
from sys import hexversion
from urllib.parse import urlparse
from http.client import HTTPSConnection
......@@ -172,7 +170,7 @@ def get_one_time_token(testcase):
while auth_token in _USED_OTA_TOKEN:
# wait until the server has renewed the token
time.sleep(1)
logger.info(f"last auth_token was: >>>{auth_token}<<<")
logger.debug(f"last auth_token was: >>>{auth_token}<<<")
with open(filename, "r") as f:
auth_token = f.read()
else:
......@@ -205,18 +203,11 @@ def test_one_time_token():
@mark.local_server
def test_one_time_token_invalid():
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} Test: start")
subprocess.run(["ls", "-al", "/authtoken"])
auth_token = get_one_time_token("admin_token_crud")
auth_token = auth_token.replace("[]", '["permission"]')
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} timeout 2m configure 1: start")
db.configure_connection(password_method="auth_token",
auth_token=auth_token)
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} configure 1: finished")
with raises(db.LoginFailedError) as lfe:
db.Info()
assert lfe.value.args[0] == (
......@@ -224,25 +215,15 @@ def test_one_time_token_invalid():
"authenticator cannot log in again. You must provide a new authentication token.")
# also raises exception when anonymous is enabled
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} configure 2: start")
db.configure_connection()
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} configure 2: finished")
db.administration.set_server_property("AUTH_OPTIONAL", "TRUE")
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} configure 3: start")
db.configure_connection(password_method="auth_token",
auth_token=auth_token)
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} configure 3: finished")
with raises(db.LoginFailedError) as lfe:
db.Info()
assert lfe.value.args[0] == (
"The authentication token is expired or you have been logged out otherwise. The auth_token "
"authenticator cannot log in again. You must provide a new authentication token.")
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.warning(f"{current_time} Test: finished")
@mark.local_server
......
......@@ -31,4 +31,3 @@ xfail_strict = True
# log_cli_level = info
# log_format = %(asctime)s %(levelname)s %(message)s
# log_date_format = %Y-%m-%d %H:%M:%S
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment