summaryrefslogtreecommitdiffstats
path: root/dom/apps/tests/create_test_receipts.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/apps/tests/create_test_receipts.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/apps/tests/create_test_receipts.py')
-rwxr-xr-xdom/apps/tests/create_test_receipts.py163
1 files changed, 163 insertions, 0 deletions
diff --git a/dom/apps/tests/create_test_receipts.py b/dom/apps/tests/create_test_receipts.py
new file mode 100755
index 000000000..e8774edec
--- /dev/null
+++ b/dom/apps/tests/create_test_receipts.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+
+import jwt
+
+receipt1 = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314356"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt2 = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314357"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_typ = {
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_product = {
+ "typ": "purchase-receipt",
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_user = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_iss = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_nbf = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_without_iat = {
+ "typ": "purchase-receipt",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+receipt_with_wrong_typ = {
+ "typ": "fake",
+ "product": {
+ "url": "https://www.mozilla.org",
+ "storedata": "5169314358"
+ },
+ "user": {
+ "type": "directed-identifier",
+ "value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
+ },
+ "iss": "http://mochi.test:8888",
+ "nbf": 131360185,
+ "iat": 131360188,
+ "detail": "http://mochi.test:8888/receipt/5169314356",
+ "verify": "http://mochi.test:8888/verify/5169314356",
+ "reissue": "http://mochi.test:8888/reissue/5169314356"
+}
+
+print("let valid_receipt1 = \"" + jwt.encode(receipt1, "") + "\";\n")
+print("let valid_receipt2 = \"" + jwt.encode(receipt2, "") + "\";\n")
+print("let receipt_without_typ = \"" + jwt.encode(receipt_without_typ, "") + "\";\n")
+print("let receipt_without_product = \"" + jwt.encode(receipt_without_product, "") + "\";\n")
+print("let receipt_without_user = \"" + jwt.encode(receipt_without_user, "") + "\";\n")
+print("let receipt_without_iss = \"" + jwt.encode(receipt_without_iss, "") + "\";\n")
+print("let receipt_without_nbf = \"" + jwt.encode(receipt_without_nbf, "") + "\";\n")
+print("let receipt_without_iat = \"" + jwt.encode(receipt_without_iat, "") + "\";\n")
+print("let receipt_with_wrong_typ = \"" + jwt.encode(receipt_with_wrong_typ, "") + "\";\n")