Mercurial > p > roundup > code
comparison roundup/test/tx_Source_detector.py @ 7033:137aabd876ad
flake8 fixes test code.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 09 Oct 2022 20:18:37 -0400 |
| parents | 58817c3bf471 |
| children | 9c3ec0a5c7fc |
comparison
equal
deleted
inserted
replaced
| 7032:f529cca242dc | 7033:137aabd876ad |
|---|---|
| 13 # | 13 # |
| 14 # Note that the calls are interleaved, but the proper | 14 # Note that the calls are interleaved, but the proper |
| 15 # tx_Source is associated with the same ticket. | 15 # tx_Source is associated with the same ticket. |
| 16 | 16 |
| 17 from __future__ import print_function | 17 from __future__ import print_function |
| 18 import time as time | 18 |
| 19 | 19 |
| 20 def tx_SourceCheckAudit(db, cl, nodeid, newvalues): | 20 def tx_SourceCheckAudit(db, cl, nodeid, newvalues): |
| 21 ''' An auditor to print the value of the source of the | 21 ''' An auditor to print the value of the source of the |
| 22 transaction that trigger this change. The sleep call | 22 transaction that trigger this change. The sleep call |
| 23 is used to delay the transaction so that multiple changes will | 23 is used to delay the transaction so that multiple changes will |
| 32 "email" - reported when using an unautheticated email based technique | 32 "email" - reported when using an unautheticated email based technique |
| 33 "email-sig-openpgp" - reported when email with a valid pgp | 33 "email-sig-openpgp" - reported when email with a valid pgp |
| 34 signature is used | 34 signature is used |
| 35 ''' | 35 ''' |
| 36 if __debug__ and False: | 36 if __debug__ and False: |
| 37 print("\n tx_SourceCheckAudit(%s) db.tx_Source: %s"%(nodeid, db.tx_Source)) | 37 print("\n tx_SourceCheckAudit(%s) db.tx_Source: %s" % ( |
| 38 nodeid, db.tx_Source)) | |
| 38 | 39 |
| 39 newvalues['tx_Source'] = db.tx_Source | 40 newvalues['tx_Source'] = db.tx_Source |
| 40 | 41 |
| 41 # example use for real to prevent a change from happening if it's | 42 # example use for real to prevent a change from happening if it's |
| 42 # submited via email | 43 # submited via email |
| 43 # | 44 # |
| 44 # if db.tx_Source == "email": | 45 # if db.tx_Source == "email": |
| 45 # raise Reject, 'Change not allowed via email' | 46 # raise Reject, 'Change not allowed via email' |
| 47 | |
| 46 | 48 |
| 47 def tx_SourceCheckReact(db, cl, nodeid, oldvalues): | 49 def tx_SourceCheckReact(db, cl, nodeid, oldvalues): |
| 48 ''' An reactor to print the value of the source of the | 50 ''' An reactor to print the value of the source of the |
| 49 transaction that trigger this change. The sleep call | 51 transaction that trigger this change. The sleep call |
| 50 is used to delay the transaction so that multiple changes will | 52 is used to delay the transaction so that multiple changes will |
| 60 "email-sig-openpgp" - reported when email with a valid pgp | 62 "email-sig-openpgp" - reported when email with a valid pgp |
| 61 signature is used | 63 signature is used |
| 62 ''' | 64 ''' |
| 63 | 65 |
| 64 if __debug__ and False: | 66 if __debug__ and False: |
| 65 print(" tx_SourceCheckReact(%s) db.tx_Source: %s"%(nodeid, db.tx_Source)) | 67 print(" tx_SourceCheckReact(%s) db.tx_Source: %s" % ( |
| 66 | 68 nodeid, db.tx_Source)) |
| 67 | 69 |
| 68 | 70 |
| 69 def init(db): | 71 def init(db): |
| 70 db.issue.audit('create', tx_SourceCheckAudit) | 72 db.issue.audit('create', tx_SourceCheckAudit) |
| 71 db.issue.audit('set', tx_SourceCheckAudit) | 73 db.issue.audit('set', tx_SourceCheckAudit) |
