aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-06-05 14:18:16 +0200
committerLorenz Diener <[email protected]>2018-06-05 14:18:16 +0200
commit65f4884ff9d7538faa08d72093a589e085e50a68 (patch)
tree0e632871a3b07b8ca22888fccea55fad01300d4a /tests/test_push.py
parent392dd3d61d7f8080faa56e0b7ac9bd09b21ef218 (diff)
downloadmastodon.py-65f4884ff9d7538faa08d72093a589e085e50a68.tar.gz
Add test for push decrypt
Diffstat (limited to 'tests/test_push.py')
-rw-r--r--tests/test_push.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_push.py b/tests/test_push.py
new file mode 100644
index 0000000..5313a3c
--- /dev/null
+++ b/tests/test_push.py
@@ -0,0 +1,23 @@
1import pytest
2
3def test_decrypt(api):
4 priv = {
5 'auth': b'\xe7y\x0fp\xb9\x92\xe0\xa0\xc5\xd5~Qr\xd7\xaa\x16',
6 'privkey': 86377660131518823691452242868806126400423244879788569019894692873283793307753
7 }
8
9 # Yes, I am aware that there is an access token in there. It's not valid anymore.
10 encryption_header = "salt=O14vjCdbxxhRUTkrsp98vw"
11 crypto_key_header = "dh=BKz_CMlF6kVURVImPDsz3bNbTv-9QTGtXpE4Fd3wQGF44fVTj32-APndoccYdjXY2U-mdTen1PDm_pHacpEmD0M;p256ecdsa=BDSAB3e_l5Qp4X50UYSSrKiZFZWDAgHlWIDhgBjXJuUzb0HrpqoCdFhMCh4o2xYHTqpvyTJ3SfFtrILLiXXWT5k"
12 data = b'\x10\\b<\xddi\xacd\x86\xc8J1\xb6}5\x01K\x85;\xd2\xd4WzN\xab\x0b|3D\xe9_YPcsG\x9fh\xae\xfe\xbb:z&\xc4\x8ek\x89\xde\xa2\xdbF\xdc\xdd[p<h\x9e\x95\x8d\xd4\xf0\xd0\xc1\x89\t\x01\xebuV\xb1\xa4Fp\xe3\xbf\x91g\x93\xbe \xe5\xd4\xee\xe2\xb0FaB\x8a\xd0\x00b\xe4Q\x83\xd5\xd9\x83\x9a\x1d\xd5j\xdb"\xc5\xb0\xf5W\xa72r4r]aLs\xa8\x8c\x1a\x19h\xfeX)_t\xd4p\xc9\xd2d\x1b?\x19\xc8X(\x02\xd5\x18\xe4\x93\xe2\xda\x01\xb4b\xe4\xd0F\x08`\x13;>\xc4\x89\xbc\xc3\x8e\xb8\x9bJ~\xc4}]\xdb\xdc\xf1wY\x16g\xf8\x91N\xee\xfd\x92\x1e\xcd\xd2~\xf2\x06\x89\xcd\xa5\xcd\x97\xb7{\xc5\xe1\xe4\xb0\x9f7\xc6\x8a5\xda\xbbm\xce\xc5\x8d\x93`&\x0e\xa9\x83\xa2|p;\xa4\x8b)\xc8\x07\rb!a\x82\xf5E\x92\x00Y{\xd4\x94\xf8\xf0\r\xb5c\x86\xfb\xd0*\xbb\xa1!\x14\xd5\x11\xc8\xafI\xb3j\xca7\xc4\x9c\xe0\x9c0\x12\xc0\xd1\x8a{\xcd\xc4~\\\xc2\x99\xf0d)\x03E\x91;m\xbe\xdb\x86\xef\xd7\xa7>\xd1a\xf1\x83!\xaeB\xaa\xf0\xda\x1b;\x86\xd8;]\x9e\xe3\xfa*!\x07,\t\xbd\xe7\xfc\xa7\xa8\xba[\xcf\x89e\xac\'\xdb\x88g\xd9\\\xe4C\x08Lb\xb6CAT\xcc!\xa4\xce\x92t3\x1c1\x01'
13
14 decrypted = api.push_subscription_decrypt_push(
15 data,
16 priv,
17 encryption_header,
18 crypto_key_header
19 )
20
21 assert decrypted
22 assert decrypted.title == 'You were mentioned by fake halcy'
23 \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)