tests: write invalid json file using codecs.encode (#36515)
This commit is contained in:
parent
844dea5853
commit
ed9cdb777c
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
import pytest
|
||||
import os
|
||||
import json
|
||||
|
@ -145,8 +147,8 @@ def test_json_datasource(http_requests):
|
|||
|
||||
# invalid json file
|
||||
get_request().datasources_cache = {}
|
||||
json_file = open(json_file_path, 'w')
|
||||
json_file.write(u'foobar'.encode('zlib_codec'))
|
||||
json_file = open(json_file_path, 'wb')
|
||||
json_file.write(codecs.encode(b'foobar', 'zlib_codec'))
|
||||
json_file.close()
|
||||
assert data_sources.get_items(datasource) == []
|
||||
|
||||
|
|
Loading…
Reference in New Issue