Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
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
Vincent Pelletier
caucase
Commits
aa090b76
Commit
aa090b76
authored
Nov 08, 2021
by
Boxiang Sun
Committed by
Vincent Pelletier
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caucase.test: CAUCASE_NETLOC should not contain literal IP addresses
parent
4e2c2fe9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
caucase/test.py
caucase/test.py
+21
-2
No files found.
caucase/test.py
View file @
aa090b76
...
@@ -388,6 +388,14 @@ class CaucaseTest(TestCase):
...
@@ -388,6 +388,14 @@ class CaucaseTest(TestCase):
)
)
self
.
_caucase_url
=
'http://'
+
netloc
self
.
_caucase_url
=
'http://'
+
netloc
parsed_url
=
urllib_parse
.
urlparse
(
self
.
_caucase_url
)
parsed_url
=
urllib_parse
.
urlparse
(
self
.
_caucase_url
)
try
:
ipaddress
.
ip_address
(
parsed_url
.
hostname
)
except
ValueError
:
pass
# parsed_url.hostname is a hostname as expected
else
:
# pragma: no cover
raise
AssertionError
(
'CAUCASE_NETLOC should not contains literal IP'
)
self
.
assertFalse
(
self
.
assertFalse
(
canConnect
((
parsed_url
.
hostname
,
parsed_url
.
port
)),
canConnect
((
parsed_url
.
hostname
,
parsed_url
.
port
)),
'Something else is already listening on %r, define CAUCASE_NETLOC '
'Something else is already listening on %r, define CAUCASE_NETLOC '
...
@@ -3795,10 +3803,21 @@ class CaucaseShellTest(TestCase):
...
@@ -3795,10 +3803,21 @@ class CaucaseShellTest(TestCase):
"""
"""
Run caucase.sh's embedded testsuite.
Run caucase.sh's embedded testsuite.
"""
"""
self
.
_run
(
'--test'
,
os
.
getenv
(
netloc
=
os
.
getenv
(
'CAUCASE_NETLOC'
,
'CAUCASE_NETLOC'
,
'localhost:8000'
,
'localhost:8000'
,
))
)
caucase_url
=
'http://'
+
netloc
parsed_url
=
urllib_parse
.
urlparse
(
caucase_url
)
try
:
ipaddress
.
ip_address
(
parsed_url
.
hostname
)
except
ValueError
:
pass
# parsed_url.hostname is a hostname as expected
else
:
# pragma: no cover
raise
AssertionError
(
'CAUCASE_NETLOC should not contains literal IP'
)
self
.
_run
(
'--test'
,
netloc
)
if
__name__
==
'__main__'
:
# pragma: no cover
if
__name__
==
'__main__'
:
# pragma: no cover
unittest
.
main
()
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