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
9a9015a7
Commit
9a9015a7
authored
Feb 09, 2017
by
vieira
Committed by
Brian May
Feb 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests after adding support for iproute2
parent
d7d24f95
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
test_server.py
sshuttle/tests/server/test_server.py
+8
-17
No files found.
sshuttle/tests/server/test_server.py
View file @
9a9015a7
...
@@ -21,8 +21,9 @@ def test__maskbits():
...
@@ -21,8 +21,9 @@ def test__maskbits():
sshuttle
.
server
.
_maskbits
(
netmask
)
sshuttle
.
server
.
_maskbits
(
netmask
)
@
patch
(
'sshuttle.server.which'
,
side_effect
=
lambda
x
:
x
==
'netstat'
)
@
patch
(
'sshuttle.server.ssubprocess.Popen'
)
@
patch
(
'sshuttle.server.ssubprocess.Popen'
)
def
test_
_listroutes
(
mock_popen
):
def
test_
listroutes_netstat
(
mock_popen
,
mock_which
):
mock_pobj
=
Mock
()
mock_pobj
=
Mock
()
mock_pobj
.
stdout
=
io
.
BytesIO
(
b
"""
mock_pobj
.
stdout
=
io
.
BytesIO
(
b
"""
Kernel IP routing table
Kernel IP routing table
...
@@ -33,30 +34,20 @@ Destination Gateway Genmask Flags MSS Window irtt Iface
...
@@ -33,30 +34,20 @@ Destination Gateway Genmask Flags MSS Window irtt Iface
mock_pobj
.
wait
.
return_value
=
0
mock_pobj
.
wait
.
return_value
=
0
mock_popen
.
return_value
=
mock_pobj
mock_popen
.
return_value
=
mock_pobj
routes
=
sshuttle
.
server
.
_
list_routes
()
routes
=
sshuttle
.
server
.
list_routes
()
env
=
{
assert
list
(
routes
)
==
[
'PATH'
:
os
.
environ
[
'PATH'
],
'LC_ALL'
:
"C"
,
}
assert
mock_popen
.
mock_calls
==
[
call
([
'netstat'
,
'-rn'
],
stdout
=-
1
,
env
=
env
),
call
()
.
wait
()
]
assert
routes
==
[
(
socket
.
AF_INET
,
'0.0.0.0'
,
0
),
(
socket
.
AF_INET
,
'192.168.1.0'
,
24
)
(
socket
.
AF_INET
,
'192.168.1.0'
,
24
)
]
]
@
patch
(
'sshuttle.server.which'
,
side_effect
=
lambda
x
:
x
==
'ip'
)
@
patch
(
'sshuttle.server.ssubprocess.Popen'
)
@
patch
(
'sshuttle.server.ssubprocess.Popen'
)
def
test_listroutes
(
mock_popen
):
def
test_listroutes
_iproute
(
mock_popen
,
mock_which
):
mock_pobj
=
Mock
()
mock_pobj
=
Mock
()
mock_pobj
.
stdout
=
io
.
BytesIO
(
b
"""
mock_pobj
.
stdout
=
io
.
BytesIO
(
b
"""
Kernel IP routing table
default via 192.168.1.1 dev wlan0 proto static
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.1
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
"""
)
"""
)
mock_pobj
.
wait
.
return_value
=
0
mock_pobj
.
wait
.
return_value
=
0
mock_popen
.
return_value
=
mock_pobj
mock_popen
.
return_value
=
mock_pobj
...
...
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