json cell: always reset json context variable (#16463)
This commit is contained in:
parent
86ba3cbb4a
commit
bac05b0cd7
|
@ -829,6 +829,7 @@ class JsonCellBase(CellBase):
|
|||
if varname in context['request'].GET and varname not in context:
|
||||
context[varname] = context['request'].GET[varname]
|
||||
self._json_content = None
|
||||
extra_context['json'] = None
|
||||
try:
|
||||
url = utils.get_templated_url(self.url, context)
|
||||
except utils.UnknownTemplateVariableError:
|
||||
|
|
|
@ -200,7 +200,7 @@ def test_json_cell():
|
|||
with mock.patch('combo.utils.requests.get') as requests_get:
|
||||
context = cell.get_cell_extra_context(Context({}))
|
||||
# can't get URL, 'foobar' variable is missing
|
||||
assert 'json' not in context
|
||||
assert context['json'] == None
|
||||
assert requests_get.call_count == 0
|
||||
request = RequestFactory().get('/')
|
||||
request.user = User(username='foo', email='foo@example.net')
|
||||
|
|
Loading…
Reference in New Issue