Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
416636fa
Commit
416636fa
authored
Nov 06, 2017
by
vieira
Committed by
Brian May
Nov 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock socket bind to avoid depending on local IPs being available in test box
parent
4300a023
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
test_helpers.py
sshuttle/tests/client/test_helpers.py
+6
-1
No files found.
sshuttle/tests/client/test_helpers.py
View file @
416636fa
...
@@ -2,6 +2,7 @@ from mock import patch, call
...
@@ -2,6 +2,7 @@ from mock import patch, call
import
sys
import
sys
import
io
import
io
import
socket
import
socket
import
errno
import
sshuttle.helpers
import
sshuttle.helpers
...
@@ -162,7 +163,11 @@ nameserver 2404:6800:4004:80c::4
...
@@ -162,7 +163,11 @@ nameserver 2404:6800:4004:80c::4
]
]
def
test_islocal
():
@
patch
(
'sshuttle.helpers.socket.socket.bind'
)
def
test_islocal
(
mock_bind
):
bind_error
=
socket
.
error
(
errno
.
EADDRNOTAVAIL
)
mock_bind
.
side_effect
=
[
None
,
bind_error
,
None
,
bind_error
]
assert
sshuttle
.
helpers
.
islocal
(
"127.0.0.1"
,
socket
.
AF_INET
)
assert
sshuttle
.
helpers
.
islocal
(
"127.0.0.1"
,
socket
.
AF_INET
)
assert
not
sshuttle
.
helpers
.
islocal
(
"192.0.2.1"
,
socket
.
AF_INET
)
assert
not
sshuttle
.
helpers
.
islocal
(
"192.0.2.1"
,
socket
.
AF_INET
)
assert
sshuttle
.
helpers
.
islocal
(
"::1"
,
socket
.
AF_INET6
)
assert
sshuttle
.
helpers
.
islocal
(
"::1"
,
socket
.
AF_INET6
)
...
...
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