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
Eric Zheng
slapos.toolbox
Commits
37f33855
Commit
37f33855
authored
Jun 30, 2021
by
Eric Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update http auth promise expected outputs
parent
3da6b987
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
slapos/test/promise/plugin/test_check_url_available.py
slapos/test/promise/plugin/test_check_url_available.py
+28
-2
No files found.
slapos/test/promise/plugin/test_check_url_available.py
View file @
37f33855
...
...
@@ -539,6 +539,28 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
self
.
launcher
.
run
()
result
=
self
.
getPromiseResult
(
self
.
promise_name
)
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
False
)
self
.
assertEqual
(
result
[
'result'
][
'message'
],
# Since require_auth = 1, we expect that the promise will try two
# requests: one with the credentials and one without.
"%r is available
\
n
%r is available"
%
(
url
,
url
)
)
# Test that the promise doesn't check whether the server requires
# credentials when we set require_auth = 0.
def
test_check_authenticate_success_no_password
(
self
):
url
=
HTTPS_ENDPOINT
+
'200'
content
=
self
.
base_content_authenticate
%
{
'url'
:
url
,
'username'
:
TEST_GOOD_USERNAME
,
'password'
:
TEST_GOOD_PASSWORD
,
'require_auth'
:
0
}
self
.
writePromise
(
self
.
promise_name
,
content
)
self
.
configureLauncher
()
self
.
launcher
.
run
()
result
=
self
.
getPromiseResult
(
self
.
promise_name
)
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
False
)
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"%r is available"
%
(
url
,)
...
...
@@ -561,7 +583,8 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
True
)
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"%r is not available (returned 401, expected 200)."
%
(
url
,)
(
"%r is not available (returned 401, expected 200)."
+
\
"%r is not available (returned 401, expected 200)."
)
%
(
url
,
url
)
)
# Test authentication failure due to the server not requiring any
...
...
@@ -581,8 +604,11 @@ class TestCheckUrlAvailable(CheckUrlAvailableMixin):
result
=
self
.
getPromiseResult
(
self
.
promise_name
)
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
True
)
self
.
assertEqual
(
# The first request should succeed, but the second one (to check
# that credentials are actually required) should fail.
result
[
'result'
][
'message'
],
"%r is not available (returned 200, expected 401)."
%
(
url
,)
(
"%r is available
\
n
"
+
\
"%r is not available (returned 200, expected 401)."
)
%
(
url
,
url
)
)
class
TestCheckUrlAvailableTimeout
(
CheckUrlAvailableMixin
):
...
...
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