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
Guillaume Hervier
slapos.toolbox
Commits
4a2409ac
Commit
4a2409ac
authored
Feb 06, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resiliency-tests: _getRcode now use lxml, which is made for this purpose
parent
a7930478
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
24 deletions
+4
-24
slapos/resiliencytest/suites/slaprunner.py
slapos/resiliencytest/suites/slaprunner.py
+4
-24
No files found.
slapos/resiliencytest/suites/slaprunner.py
View file @
4a2409ac
...
...
@@ -31,6 +31,7 @@ from .resiliencytestsuite import ResiliencyTestSuite
import
base64
import
cookielib
import
json
from
lxml
import
etree
import
random
import
string
import
time
...
...
@@ -170,27 +171,6 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
)
def
_getRcode
(
self
):
from
HTMLParser
import
HTMLParser
class
MyHTMLParser
(
HTMLParser
):
def
__init__
(
self
):
HTMLParser
.
__init__
(
self
)
self
.
recovery_code
=
""
self
.
attributes
=
None
def
handle_starttag
(
self
,
tag
,
attrs
):
print
"Encountered a start tag:"
,
tag
,
" with attrs:"
,
attrs
for
at
,
val
in
attrs
:
if
at
==
"name"
and
val
==
"recovery-code"
:
self
.
attributes
=
attrs
def
getRcode
(
self
):
if
type
(
self
.
attributes
)
==
list
:
for
attr
,
val
in
self
.
attributes
:
if
attr
==
"value"
:
return
val
else
:
return
""
#XXX-Nicolas: hardcoded url. Best way right now to automate the tests...
monitor_url
=
self
.
monitor_url
+
"?script=zero-knowledge%2Fsettings.cgi"
result
=
self
.
_opener_director
.
open
(
monitor_url
,
...
...
@@ -200,10 +180,10 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
raise
NotHttpOkException
(
result
.
getcode
())
page
=
result
.
read
().
strip
()
html
=
etree
.
HTML
(
page
)
parser
=
MyHTMLParser
()
parser
.
feed
(
page
)
return
parser
.
getRcode
input
=
html
.
xpath
(
"//input[@name='recovery-code']"
)
return
input
[
0
].
get
(
'value'
)
def
generateData
(
self
):
self
.
slaprunner_password
=
''
.
join
(
...
...
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