turns out the builder isn't sending json
This commit is contained in:
Родитель
664afcf9d1
Коммит
6d45e29f7c
|
@ -387,7 +387,7 @@ def cspreport(request):
|
|||
@post_required
|
||||
def builder_pingback(request):
|
||||
try:
|
||||
data = json.loads(request.raw_post_data)
|
||||
data = dict(request.POST.items())
|
||||
# We expect all these attributes to be available.
|
||||
attrs = 'result msg filename location secret request'.split()
|
||||
for attr in attrs:
|
||||
|
|
|
@ -450,19 +450,18 @@ class TestDiffViewer(FilesBase, test_utils.TestCase):
|
|||
class TestBuilderPingback(test_utils.TestCase):
|
||||
|
||||
def post(self, data):
|
||||
return self.client.post(reverse('amo.builder-pingback'), data,
|
||||
content_type='application/json')
|
||||
return self.client.post(reverse('amo.builder-pingback'), data)
|
||||
|
||||
def test_success(self):
|
||||
r = self.post(json.dumps({'result': '', 'msg': '', 'filename': '',
|
||||
'location': '', 'request': '',
|
||||
'secret': settings.BUILDER_SECRET_KEY}))
|
||||
r = self.post({'result': '', 'msg': '', 'filename': '',
|
||||
'location': '', 'request': '',
|
||||
'secret': settings.BUILDER_SECRET_KEY})
|
||||
eq_(r.status_code, 200)
|
||||
|
||||
def test_bad_secret(self):
|
||||
r = self.post(json.dumps({'secret': 1}))
|
||||
r = self.post({'secret': 1})
|
||||
eq_(r.status_code, 400)
|
||||
|
||||
def test_bad_json(self):
|
||||
r = self.post('wut')
|
||||
def test_bad_data(self):
|
||||
r = self.post({'wut': 0})
|
||||
eq_(r.status_code, 400)
|
||||
|
|
Загрузка…
Ссылка в новой задаче