|
29 | 29 | from lib.core.threads import getCurrentThreadData |
30 | 30 |
|
31 | 31 | def comparison(page, headers, code=None, getRatioValue=False, pageLength=None): |
32 | | - #return _checkNegativeLogic(_comparison(page, headers, code, getRatioValue, pageLength), getRatioValue) |
33 | | - return _comparison(page, headers, code, getRatioValue, pageLength) |
| 32 | + return _adjust(_comparison(page, headers, code, getRatioValue, pageLength), getRatioValue) |
| 33 | + |
| 34 | +def _adjust(condition, getRatioValue): |
| 35 | + # Negative logic approach is used in raw page comparison scheme as that what is "different" than original |
| 36 | + # PAYLOAD.WHERE.NEGATIVE response is considered as True; in switch based approach negative logic is not |
| 37 | + # applied as that is by the user considered as True is that what is returned by the comparison mechanism |
| 38 | + # itself |
| 39 | + if not any([conf.string, conf.regexp, conf.code]): |
| 40 | + retVal = not (condition or False) if kb.negativeLogic else condition |
| 41 | + else: |
| 42 | + retVal = condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO) |
34 | 43 |
|
35 | | -def _checkNegativeLogic(condition, getRatioValue): |
36 | | - condition = not (condition or False) if kb.negativeLogic else condition |
37 | | - return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO) |
| 44 | + return retVal |
38 | 45 |
|
39 | 46 | def _comparison(page, headers, code, getRatioValue, pageLength): |
40 | 47 | if page is None and pageLength is None: |
|
0 commit comments