Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
887cc3a2
Unverified
Commit
887cc3a2
authored
1 month ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
TEST(wip): minimizing changes for fix.
parent
44216e72
No related branches found
No related tags found
No related merge requests found
Pipeline
#65392
passed
1 month ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_authentication.py
+1
-20
1 addition, 20 deletions
tests/test_authentication.py
tox.ini
+0
-1
0 additions, 1 deletion
tox.ini
with
1 addition
and
21 deletions
tests/test_authentication.py
+
1
−
20
View file @
887cc3a2
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tox.ini
+
0
−
1
View file @
887cc3a2
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment