Enable ordering constraints in the engine (#381)

When specified in the 'pre_send' section of the grammar, reader variables
are added to the _consumer list, in the same way as when they are
part of the payload.

Testing: tested manually by adding the following annotations to demo_server,
and confirming that every sequence starts with the GET request.

{"x-restler-global-annotations":
[{
  "producer_endpoint": "/blog/posts",
  "producer_method": "GET",
  "consumer_endpoint": "/blog/posts",
  "consumer_method": "POST"
}]
}
This commit is contained in:
marina-p 2021-10-19 17:12:08 -07:00 коммит произвёл GitHub
Родитель 6b2ddf7399
Коммит cf9c028f07
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -263,6 +263,12 @@ class Request(object):
var_name = self._get_var_name_from_definition_line(line)
if var_name:
self._consumes.add(var_name)
# Also look for reader placeholders in the pre_send section
if bool(self.metadata) and 'pre_send' in self.metadata\
and 'dependencies' in self.metadata['pre_send']:
for reader_var in self.metadata['pre_send']['dependencies']:
var_name = reader_var.split(dependencies.RDELIM)[1]
self._consumes.add(var_name)
# Look for writer placeholders
if bool(self.metadata) and 'post_send' in self.metadata\