Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxyaddr fix #46

Merged
merged 4 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pysipp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def scenario(dirpath=None, proxyaddr=None, autolocalsocks=True,
scenkwargs=scenkwargs
)

if proxyaddr:
assert isinstance(
proxyaddr, tuple), 'proxyaddr must be a (addr, port) tuple'
scen.clientdefaults.proxyaddr = proxyaddr
if proxyaddr:
assert isinstance(
proxyaddr, tuple), 'proxyaddr must be a (addr, port) tuple'
scen.clientdefaults.proxyaddr = proxyaddr

return scen

Expand Down
4 changes: 2 additions & 2 deletions pysipp/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ def merge(dicts):
# apply defaults
ordered = [self._defaults, secondary, agent.todict()]
for name, defs in zip(['defaults', dname, 'agent.todict()'], ordered):
log.debug("'{}' contents:\n{}".format(name, defs))
log.debug("{} '{}' contents:\n{}".format(agent.name, name, defs))

params = merge(ordered)
log.debug("merged contents:\n{}".format(params))
log.debug("{} merged contents:\n{}".format(agent.name, params))
ua = UserAgent(defaults=params)

ua.enable_logging(enable_screen_file=self.enable_screen_file)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
url='https://github.com/SIPp/pysipp',
platforms=['linux'],
packages=['pysipp', 'pysipp.cli'],
install_requires=['pluggy==0.3.1'],
install_requires=['pluggy==0.11.0'],
tests_require=['pytest'],
entry_points={
'console_scripts': [
Expand Down
19 changes: 19 additions & 0 deletions tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ def test_confpy_hooks(scendir):
assert agent.uri_username == 'doggy'


def test_proxyaddr_with_scendir(scendir):
"""When building a scenario from a xml file directory the
`proxyaddr` kwarg should be assigned.
"""
remoteaddr = ('9.9.9.9', 80)
scen = pysipp.scenario(
dirpath=scendir + '/default_with_confpy',
proxyaddr=remoteaddr
)

assert scen.clientdefaults.proxyaddr == remoteaddr
for name, cmd in scen.cmditems():
if name == 'uac':
assert "-rsa '{}':'{}'".format(*remoteaddr) in cmd
assert "'{}':'{}'".format(*scen.clientdefaults.destaddr) in cmd
elif name == 'uas':
assert "-rsa '{}':'{}'".format(*remoteaddr) not in cmd


def test_sync_run(scenwalk):
"""Ensure all scenarios in the test run to completion in synchronous mode
"""
Expand Down