diff --git a/pysipp/__init__.py b/pysipp/__init__.py index 3e68a6b..46eb248 100644 --- a/pysipp/__init__.py +++ b/pysipp/__init__.py @@ -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 diff --git a/pysipp/agent.py b/pysipp/agent.py index a57a312..2947755 100644 --- a/pysipp/agent.py +++ b/pysipp/agent.py @@ -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) diff --git a/setup.py b/setup.py index 80128cd..a13dc99 100755 --- a/setup.py +++ b/setup.py @@ -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': [ diff --git a/tests/test_stack.py b/tests/test_stack.py index 346df9c..3aa9b82 100644 --- a/tests/test_stack.py +++ b/tests/test_stack.py @@ -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 """