[asterisk-dev] [Code Review] SIP TLS Registration Test

wdoekes reviewboard at asterisk.org
Tue Dec 6 02:21:26 CST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1548/#review4924
-----------------------------------------------------------


A bit of pedantic python checking.


/asterisk/trunk/lib/python/asterisk/utils.py
<https://reviewboard.asterisk.org/r/1548/#comment9190>

    import os, shutil, tempfile
    
    would've been enough for my taste.
    
    Or if you really like them in the global scope:
    
    from os import close, remove
    
    But seeing a move() without any package/module before it always leaves me to guess who/what it moves. When you see shutil.move() you immediately see what it does.



/asterisk/trunk/lib/python/asterisk/utils.py
<https://reviewboard.asterisk.org/r/1548/#comment9186>

    Prefer lowercase (with underscores) for functions. The 'which' function above isn't called Which either.
    
    And don't call "needle" a "pattern". Patterns do globbing or regex or something magic.



/asterisk/trunk/lib/python/asterisk/utils.py
<https://reviewboard.asterisk.org/r/1548/#comment9187>

    fd, abs_path = mkstemp()
    new_file = os.fdopen(fd, 'w')
    
    .. and remove the close(fh) below.



/asterisk/trunk/tests/channels/SIP/sip_tls_register/run-test
<https://reviewboard.asterisk.org/r/1548/#comment9189>

    Don't do this:
    
    'abc/%s' % (somestring)
    
    Because it means this:
    
    'abc/%s' % somestring
    
    But it looks like you meant this, but failed:
    
    'abc/%s' % (somestring,)
    
    Choose one of the latter two options.



/asterisk/trunk/tests/channels/SIP/sip_tls_register/run-test
<https://reviewboard.asterisk.org/r/1548/#comment9191>

    Unnecessary parentheses.


- wdoekes


On Dec. 2, 2011, 12:25 p.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1548/
> -----------------------------------------------------------
> 
> (Updated Dec. 2, 2011, 12:25 p.m.)
> 
> 
> Review request for Asterisk Developers, Paul Belanger, opticron, and mjordan.
> 
> 
> Summary
> -------
> 
> test: channels/SIP/sip_tls_register
> 
> Works in a similar way to sip_register, but uses TLS (which means it has to manage certificate files) and it also uses the TestCase class as well to simplify things.
> 
> I made a few changes the other day to get sip_register working normally under my dev machines, and that went fine, but I left the skip option on for it because it mentioned something about failing under FreeBSD, which would imply to me that there is some other reason they were explicitly failing under FreeBSD.  If that's the case, this test also will probably fail under FreeBSD since it makes use of basically all the same library functions as the regular sip_register test.  I'd like some advice on checking whether this failure is still a problem.
> 
> There is also some copying of files that goes on to put relevant keys into the working directory, which if ran from the test suite directory means these keys will be placed in the main testsuite folder.  I'm not sure if I should be doing this (I do clean the files up afterwards, but it's rather awkward) or changing my working directory instead and simply set aside a folder for these files to already be accessible from in the first place.
> 
> 
> Diffs
> -----
> 
>   /asterisk/trunk/lib/python/asterisk/utils.py 2826 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/ast1/sip.conf PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/ca.cfg PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/ca.crt PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/ca.key PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverA.crt PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverA.csr PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverA.key PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverA.pem PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverB.crt PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverB.csr PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverB.key PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/serverB.pem PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/keys/tmp.cfg PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/configs/sip_helper_template.inc PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/run-test PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/sipp/register.xml PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/sip_tls_register/test-config.yaml PRE-CREATION 
>   /asterisk/trunk/tests/channels/SIP/tests.yaml 2826 
> 
> Diff: https://reviewboard.asterisk.org/r/1548/diff
> 
> 
> Testing
> -------
> 
> I made sure the test passes and that the log messages show that the SIP dialog is happening as what would be expected.  In both cases, this test seems to do what it's supposed to do.
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111206/19906e89/attachment-0001.htm>


More information about the asterisk-dev mailing list