plugin XEP-0373, tests (unit/XEP-0373): Make rpad size >= 50:
XEP-0420 bounds starts at 0 but 0-length rpad defeats its purpose (the XEP actually says "TODO: sane boundaries?"). Furthermore, some tests where failing randomly due to 0-lenght rpad sometimes happening. This patch makes rpad minimum size at 50.
This commit is contained in:
parent
73b410aa97
commit
09bef94ffe
2 changed files with 13 additions and 6 deletions
|
|
@ -32,7 +32,8 @@ def test_signcrypt_element() -> None:
|
|||
signcrypt_elt.children.remove(rpad_elt)
|
||||
signcrypt_elt.children.remove(time_elt)
|
||||
|
||||
assert rpad
|
||||
# Our implementation uses a minimum of 50 characters for security
|
||||
assert len(rpad) >= 50
|
||||
assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
|
||||
assert signcrypt_elt.toXml() == (
|
||||
"<signcrypt xmlns='urn:xmpp:openpgp:0'>"
|
||||
|
|
@ -63,7 +64,8 @@ def test_sign_element_with_rpad() -> None:
|
|||
sign_elt.children.remove(rpad_elt)
|
||||
sign_elt.children.remove(time_elt)
|
||||
|
||||
assert rpad
|
||||
# Our implementation uses a minimum of 50 characters for security
|
||||
assert len(rpad) >= 50
|
||||
assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
|
||||
assert sign_elt.toXml() == (
|
||||
"<sign xmlns='urn:xmpp:openpgp:0'>"
|
||||
|
|
@ -113,7 +115,8 @@ def test_crypt_element_with_recipients() -> None:
|
|||
crypt_elt.children.remove(rpad_elt)
|
||||
crypt_elt.children.remove(time_elt)
|
||||
|
||||
assert rpad
|
||||
# Our implementation uses a minimum of 50 characters for security
|
||||
assert len(rpad) >= 50
|
||||
assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
|
||||
assert crypt_elt.toXml() == (
|
||||
"<crypt xmlns='urn:xmpp:openpgp:0'>"
|
||||
|
|
@ -139,7 +142,8 @@ def test_crypt_element_without_recipients() -> None:
|
|||
crypt_elt.children.remove(rpad_elt)
|
||||
crypt_elt.children.remove(time_elt)
|
||||
|
||||
assert rpad
|
||||
# Our implementation uses a minimum of 50 characters for security
|
||||
assert len(rpad) >= 50
|
||||
assert (datetime.now(timezone.utc) - timestamp) < timedelta(seconds=10)
|
||||
assert crypt_elt.toXml() == (
|
||||
"<crypt xmlns='urn:xmpp:openpgp:0'>"
|
||||
|
|
|
|||
Loading…
Reference in a new issue