Skip to content

Commit

Permalink
Merge pull request #138 from NebraLtd/kashifpk/get_payload_from_clear…
Browse files Browse the repository at this point in the history
…signed_message_test_update

get payload from clearsigned message test update
  • Loading branch information
kashifpk authored Mar 5, 2022
2 parents c37e01f + e3f0faa commit 0e98d3b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions hm_pyhelper/tests/test_util_pgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@
-----END PGP SIGNATURE-----
"""

SAMPLE_CLEARSIGNED_MESSAGE_NO_NEWLINE_AT_END = """
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
{
"key1": "value1",
"key2": [1, 2, 3, 4]
}
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEEfSH7Wj/J4hZxOpWqMy5fwG12lo0FAmIDUGEACgkQMy5fwG12
lo0WDwv+Nn8ffqY3oKOQv11eRkn+w4NcAp5XFqwYz0e5e+DEfjoYYTVAEgUdK1gF
W2u8Jed9rW710A6yYXHlIZWKSHsQ1sob5lK3R/r+/lFrXLYYwgFGBWJmph/wuiQW
OuZPpenOPNNjh37xxxxwxMj2kqUHKfJ489H2xOpPqpA4tWRKAspQCkv/AFVctcr5
1gWhJ5M5Mw/W6mgLswzonpsRy9M+vknuiDJ9F/Qe2hWUBJ0p7Si7YJkrynF3Oiqz
3D3JCiZAmoHq31hxO3bU7Sltf0lp1E7rG7mx7l0Pxq3fzNgaA9IW30NuF9J3YohK
Cv4pl11BYuUsBiQZktKcUwAsNj+UmZTnFBWACn4444+tFvs/tgG3wFZA33y3HAkl
6X9WGEa4d+DXeMgk2hr5oMRI9tZWqhNFqpu96CzrjJDxchgpeYjSCFiiX3po6Gyd
vH8uvB5hNKzj1vwqEtyyyyikUrPBe+273VeXNB+npF4LRok1MBjHZ49oZd2GZKBl
vo5u8szs
=i6qt
-----END PGP SIGNATURE-----
"""


class TestUtilPGP(unittest.TestCase):

Expand All @@ -53,3 +77,9 @@ def test_payload_extraction(self):
d = json.loads(payload)
assert d['key1'] == 'value1'
assert d['key2'] == [1, 2, 3, 4]

payload = get_payload_from_clearsigned_message(
SAMPLE_CLEARSIGNED_MESSAGE_NO_NEWLINE_AT_END)
d = json.loads(payload)
assert d['key1'] == 'value1'
assert d['key2'] == [1, 2, 3, 4]

0 comments on commit 0e98d3b

Please sign in to comment.