Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.toolbox
Commits
6bceac64
Commit
6bceac64
authored
Aug 09, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test / runner: adds new class with a basic auth/auth change test.
parent
3d28f5b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
slapos/test/test_runner.py
slapos/test/test_runner.py
+40
-0
No files found.
slapos/test/test_runner.py
0 → 100644
View file @
6bceac64
import
os
import
string
import
random
import
unittest
from
slapos.runner
import
views
as
runner_views
from
slapos.runner
import
utils
as
runner_utils
from
slapos.runner
import
sup_process
as
runner_process
class
TestRunner
(
unittest
.
TestCase
):
def
tearDown
(
self
):
htpasswd_file
=
os
.
path
.
join
(
*
(
os
.
getcwd
(),
'.htpasswd'
))
if
os
.
path
.
exists
(
htpasswd_file
):
os
.
remove
(
htpasswd_file
)
def
test_UserCanLoginAndUpdateCredentials
(
self
):
"""
* Create a user with createNewUser
* Tests user can login with checkUserCredential
* Updates user password updateUserCredential
* Checks user can login with new credentials
"""
def
generate_password
():
return
""
.
join
(
random
.
sample
(
\
string
.
ascii_letters
+
string
.
digits
+
string
.
punctuation
,
20
))
config
=
{
'etc_dir'
:
os
.
getcwd
()}
login
=
"admin"
password
=
generate_password
()
self
.
assertTrue
(
runner_utils
.
createNewUser
(
config
,
login
,
password
))
self
.
assertTrue
(
runner_utils
.
checkUserCredential
(
config
,
login
,
password
))
new_password
=
generate_password
()
self
.
assertNotEqual
(
password
,
new_password
)
runner_utils
.
updateUserCredential
(
config
,
login
,
new_password
)
self
.
assertTrue
(
runner_utils
.
checkUserCredential
(
config
,
login
,
new_password
))
if
__name__
==
'__main__'
:
random
.
seed
()
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment