Closed
Bug 794000
Opened 12 years ago
Closed 12 years ago
ValueError: No JSON object could be decoded
Categories
(Marketplace Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: tarek, Assigned: tarek)
References
Details
test_invalid_signature (zamboni.mkt.receipts.tests.test_verify.TestVerify) ... 12:23:11 jwt:DEBUG Could not decode a segment :/home/marketplace/.virtualenvs/marketplace/src/pyjwt/jwt/__init__.py:101
Traceback (most recent call last):
File "/home/marketplace/.virtualenvs/marketplace/src/pyjwt/jwt/__init__.py", line 96, in decode
header = json.loads(base64url_decode(header_segment))
File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
ok
Assignee | ||
Comment 1•12 years ago
|
||
the sample at https://github.com/mozilla/zamboni/blob/master/mkt/receipts/tests/test_verify.py#L34 cannot be parsed by jwt. it looks like an invalid payload
Assignee | ||
Comment 2•12 years ago
|
||
turns out the mock was active on the right settings module.
and the services/util.py module makes teh assumption the settings file is name settings_local.py, which is not our case if we run the tests using settings+local_mkt
this fix seems to work, but I wonder if it's the cleanest way
Wil, r?
(marketplace)marketplace@ubuntu:~/zamboni$ git diff /home/marketplace/zamboni/services/utils.py
diff --git a/services/utils.py b/services/utils.py
index 2951967..e43cd60 100644
--- a/services/utils.py
+++ b/services/utils.py
@@ -1,7 +1,14 @@
from datetime import datetime, timedelta
import dictconfig
import logging
-import settings_local as settings
+import os
+
+# get the right settings module
+import imp
+settingmodule = os.environ['DJANGO_SETTINGS_MODULE']
+res = imp.find_module(settingmodule)
+settings = imp.load_module(settingmodule, *res)
+
import posixpath
import re
import sys
@@ -14,7 +21,6 @@ from django.core.management import setup_environ
import commonware.log
# Pyflakes will complain about these, but they are required for setup.
-import settings_local as settings
setup_environ(settings)
from lib.log_settings_base import formatters, handlers, loggers
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → tarek
Comment 3•12 years ago
|
||
r+
Assignee | ||
Comment 4•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•