[asterisk-dev] [Code Review] 3071: Testsuite: Check CEL Extra fields in an order-agnostic way
wdoekes
reviewboard at asterisk.org
Sat Dec 14 04:18:58 CST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3071/#review10417
-----------------------------------------------------------
Ship it!
asterisk/trunk/lib/python/asterisk/ami.py
<https://reviewboard.asterisk.org/r/3071/#comment19859>
re.match is anchored at the start, but not at the end.
HangupCause: '1' (unallocated)
would therefore match both 1 and all other numbers starting with 1.
I'd rather see you use re.search (no anchoring) and add explicit anchors to the regexes OR add a match.end() == len(str(value)) check to assert that the whole value was matched.
Same applies to the next re.match().
Previously we would write '.*1.*' and see that it was a sloppy match, but now you get the wrong expectations when you write '1'.
The rest looks good.
- wdoekes
On Dec. 13, 2013, 6:50 p.m., opticron wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3071/
> -----------------------------------------------------------
>
> (Updated Dec. 13, 2013, 6:50 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Bugs: ASTERISK-22885
> https://issues.asterisk.org/jira/browse/ASTERISK-22885
>
>
> Repository: testsuite
>
>
> Description
> -------
>
> This adds new functionality to the AMI-based CEL event module to allow checking the CEL Extra field in a way that doesn't depend on arbitrary ordering and thus prevents tests checking this data from bouncing.
>
>
> Diffs
> -----
>
> asterisk/trunk/tests/bridge/transfer_failure/test-config.yaml 4437
> asterisk/trunk/sample-yaml/ami-config.yaml.sample 4437
> asterisk/trunk/lib/python/asterisk/ami.py 4437
>
> Diff: https://reviewboard.asterisk.org/r/3071/diff/
>
>
> Testing
> -------
>
> Ensured that the data was being checked properly and that order of appearance did not affect the results of the test.
>
>
> Thanks,
>
> opticron
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131214/e8174dd1/attachment.html>
More information about the asterisk-dev
mailing list