fix JSON-to-Python null-to-None conversion when reading examples (from grammar.json) (#239)

This commit is contained in:
Patrice Godefroid 2021-06-04 18:59:10 -07:00 коммит произвёл GitHub
Родитель b86a6c5d6a
Коммит 65f46afb78
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -156,10 +156,14 @@ class PayloadBodyChecker(CheckerBase):
for example in last_request.examples.body_examples:
tag_content = example.get_schema_tag_mapping()
for tag in tag_content:
# replace example value None by the string 'null'
val = tag_content[tag]
if val == None:
val = 'null'
if tag in self._examples_values:
self._examples_values[tag].append(tag_content[tag])
self._examples_values[tag].append(val)
else:
self._examples_values[tag] = [tag_content[tag]]
self._examples_values[tag] = [val]
# set the initial starting body schemas
if last_request.examples and self._start_with_examples: