Validating pysipp.clien() args at construction time
Hello,
Using latest pysipp (with sipp 3.5.2):
import pysipp
uac = pysipp.client(invalid_arg='foo')
Is there a way to trigger an error or warning when passing an invalid argument ? Best regards
Ahh good catch. Yeah we should probably have an arg validator 😂
I'm kind of surprised this doesn't error.
@oza4h07 would you mind writing a simple test for this and then we can get a patch in?
I'll try to write such test in the coming days ... Thanks for looking at this !
@oza4h07 no problema amigo.
I think our main issue is going to be that all the option keys are currently defined inside strings in our sipp_spec: list[Union[str, Field]] thing.
Looking at the code it seems like it should already be raising an error:
- when we load and parse the spec we do actually stash all the allowed arg / attribute names inside
Renderer._specparamsand this should be used for validation? - somehow the
kwargstopysipp.client(invalid_arg='foo')aren't being passed through and triggering this assign logic as expected?- If you trace it back to the
UserAgentit looks likeSippCmd.__init__()calls.applydict()and maybe becauseself._init = Trueis set after that call you have that issue?
- If you trace it back to the
I would try adjusting line 121 to be above line 119 and see if that catches this. Only question is if it will break everything else 😂