我正在将tavern
用作我的python项目的测试框架。测试的模拟服务器在yaml文件中定义:
test_name: Test phonebook service
stages:
-name: Make sure we can create new contact
request:
url: http://localhost:9301/v2/contact
method: POST
response:
status_code: 200
body:
id: 1
运行测试时出现此错误:
/Users/joey/.pyenv/versions/3.7.2/lib/python3.7/site-packages/yaml/scanner.py:579: in fetch_value
self.get_mark())
E yaml.scanner.ScannerError: mapping values are not allowed here
E in "/Users/joey/dev/iress/devel/phonebook-service-api/src/api/tavern-tests/test_contact.tavern.yaml", line 5, column 11
第5行是request:
,但我不知道这有什么问题。我认为这不是tavern
问题,而更像是yaml
模式验证问题。
答案 0 :(得分:0)
最后,我通过在space
和-
之间放置name
来使其正常工作。
test_name: Test phonebook service
stages:
- name: Make sure we can create new contact
request:
url: http://localhost:9301/v2/contact
method: POST
response:
status_code: 200
body:
id: 1