-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from isi-adas/BR_ISILONQE_977
Br isilonqe 977
- Loading branch information
Showing
4 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
|
||
from pike.model import Client | ||
from pike.smb2 import Dialect | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"min_dialect,max_dialect", | ||
( | ||
pytest.param(None, None, id="None/None"), | ||
pytest.param(Dialect.DIALECT_SMB2_1, None, id="lower bound"), | ||
pytest.param(None, Dialect.DIALECT_SMB2_1, id="upper bound"), | ||
pytest.param(Dialect.DIALECT_SMB3_1_1, Dialect.DIALECT_SMB2_002, id="inverted"), | ||
pytest.param(Dialect.DIALECT_SMB3_0, float("inf"), id="upper bound inf"), | ||
pytest.param(Dialect.DIALECT_SMB3_0, 0xFFFFFFFF, id="upper bound int"), | ||
pytest.param(float("-inf"), Dialect.DIALECT_SMB2_002, id="lower bound -inf"), | ||
pytest.param(0, Dialect.DIALECT_SMB3_0_2, id="lower bound zero"), | ||
), | ||
) | ||
def test_restrict_dialect(min_dialect, max_dialect): | ||
c = Client() | ||
c.restrict_dialects(min_dialect, max_dialect) | ||
print( | ||
"restrict_dialects(min_dialect={}, max_dialect={}) => {}".format( | ||
min_dialect, max_dialect, c.dialects | ||
) | ||
) | ||
for d in c.dialects: | ||
if min_dialect is None: | ||
min_dialect = min(Dialect.values()) | ||
if max_dialect is None: | ||
max_dialect = max(Dialect.values()) | ||
assert d >= min_dialect | ||
assert d <= max_dialect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
# | ||
# Abstract: | ||
# | ||
# Test IOCTLs. Currently, only FSCTL_VALIDATE_NEGOTIATE_INFO | ||
# Test IOCTLs | ||
# | ||
# Authors: Ki Anderson ([email protected]) | ||
# Paul Martin ([email protected]) | ||
|
@@ -41,29 +41,28 @@ | |
import pike.test as test | ||
import pike.ntstatus | ||
|
||
|
||
class ValidateNegotiateInfo(test.PikeTest): | ||
def __init__(self, *args, **kwds): | ||
super(ValidateNegotiateInfo, self).__init__(*args, **kwds) | ||
self.default_client.dialects = [ | ||
smb2.DIALECT_SMB3_0, | ||
smb2.DIALECT_SMB3_0_2] | ||
self.set_client_dialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_0_2) | ||
|
||
# VALIDATE_NEGOTIATE_INFO fsctl succeeds for SMB3 | ||
@test.RequireDialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_0_2) | ||
def test_validate_negotiate_smb3(self): | ||
self.set_client_dialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_0_2) | ||
chan, tree = self.tree_connect() | ||
chan.validate_negotiate_info(tree) | ||
|
||
|
||
class QueryNetworkInterfaceInfo(test.PikeTest): | ||
def __init__(self, *args, **kwds): | ||
super(QueryNetworkInterfaceInfo, self).__init__(*args, **kwds) | ||
self.default_client.dialects = [ | ||
smb2.DIALECT_SMB3_0, | ||
smb2.DIALECT_SMB3_0_2] | ||
self.set_client_dialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_1_1) | ||
|
||
@test.RequireDialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_0_2) | ||
@test.RequireDialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_1_1) | ||
def test_query_interface_info_smb3(self): | ||
self.set_client_dialect(smb2.DIALECT_SMB3_0, smb2.DIALECT_SMB3_1_1) | ||
chan, tree = self.tree_connect() | ||
try: | ||
chan.query_network_interface_info(tree) | ||
|