关于Yaml模式验证的错误(这里不允许使用映射值)是什么意思?

时间:2019-08-25 23:59:46

标签: python python-3.x yaml tavern

我正在将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模式验证问题。

1 个答案:

答案 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
相关问题