From 1adf41f18628eb35ba022dff803a3a5ce55c866a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 12 Oct 2018 10:35:20 -0400 Subject: [PATCH 1/4] Add test for #36 Add a test which demonstrates a bug where if a scenario is loaded from a directory that the `proxyaddr` is never set. --- tests/test_stack.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 """ From 79b75345aedded392ae71e83ad80d4dbbf0a31a0 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 12 Oct 2018 10:37:30 -0400 Subject: [PATCH 2/4] Fix #36 Thanks to @y-luis for originally finding and fixing this problem. The original PR (#35) was discarded accidentally. --- pysipp/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From 9dddfe8bb7e7c01d08e2cbd7e7467b6d21d7cb06 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 12 Oct 2018 11:01:29 -0400 Subject: [PATCH 3/4] Add agent name to options merge logging --- pysipp/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From e2ef59b16d0e59acef68b6792d2b98e1c13a3410 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 27 May 2019 09:49:40 -0400 Subject: [PATCH 4/4] Use pluggy 0.11.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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': [