Okay so I've been trying to find information on this problem however it seems that your package is fairly new so I can't find much online. Anyways, my problem is that I am trying to test my server however I keep ending up with badschemaerrors whenever I try to test my yaml file with pytest. Here is my yaml file:
# test_sz.tavern.yaml
---
test_name: Testing Authentication Module
stages:
request:
url: https://localhost:8443/api/authenticate
method: POST
data:
password: *****
username: *****
thirdPartyLogin: false
forceLogin: false
headers:
content-type: application/x-www-form-urlencoded
response:
status_code: 200
---
and here is what I get in response to running py.test in the same directory as the file:
C:\Users\TON\Documents\Rest API Pulling Documentation>py.test
============================= test session starts =============================
platform win32 -- Python 3.6.4, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
rootdir: C:\Users\TON\Documents\Rest API Pulling Documentation, inifile:
plugins: tavern-0.2.1
collected 0 items / 1 errors
=================================== ERRORS ====================================
____________________ ERROR collecting test_sz.tavern.yaml _____________________
..\..\appdata\local\programs\python\python36-32\lib\site-packages\tavern\schemas\files.py:38: in verify_generic
verifier.validate()
..\..\appdata\local\programs\python\python36-32\lib\site-packages\pykwalify\core.py:176: in validate
error_msg=u'.\n - '.join(self.validation_errors)))
E pykwalify.errors.SchemaError: <SchemaError: error code 2: Schema validation failed:
E - Value '{'request': {'data': {'forceLogin': False, 'password': 'Panduit12', 'thirdPartyLogin': False, 'username': 'admin'}, 'headers': {'content-type': 'application/x-www-form-urlencoded'}, 'method': 'POST', 'url': 'https://localhost:8443/api/authenticate'}, 'response': {'status_code': 200}}' is not a list. Value path: '/stages'.: Path: '/'>
The above exception was the direct cause of the following exception:
..\..\appdata\local\programs\python\python36-32\lib\site-packages\tavern\testutils\pytesthook.py:49: in collect
verify_tests(test_spec)
..\..\appdata\local\programs\python\python36-32\lib\site-packages\tavern\schemas\files.py:82: in verify_tests
verify_generic(test_tmp, schema_filename)
..\..\appdata\local\programs\python\python36-32\lib\site-packages\tavern\schemas\files.py:41: in verify_generic
raise_from(BadSchemaError(), e)
..\..\appdata\local\programs\python\python36-32\lib\site-packages\future\utils\__init__.py:398: in raise_from
exec(execstr, myglobals, mylocals)
<string>:1: in <module>
???
E tavern.util.exceptions.BadSchemaError
------------------------------- Captured stderr -------------------------------
validation.invalid
--- All found errors ---
["Value '{'request': {'data': {'forceLogin': False, 'password': '****', 'thirdPartyLogin': False, 'username': '****'}, 'headers': {'content-type': 'application/x-www-form-urlencoded'}, 'method': 'POST', 'url': 'https://localhost:8443/api/authenticate'}, 'response': {'status_code': 200}}' is not a list. Value path: '/stages'"]
Error validating C:\Users\TON\AppData\Local\Temp\tmp8irts1la.yaml
Traceback (most recent call last):
File "c:\users\ton\appdata\local\programs\python\python36-32\lib\site-packages\tavern\schemas\files.py", line 38, in verify_generic
verifier.validate()
File "c:\users\ton\appdata\local\programs\python\python36-32\lib\site-packages\pykwalify\core.py", line 176, in validate
error_msg=u'.\n - '.join(self.validation_errors)))
pykwalify.errors.SchemaError: <SchemaError: error code 2: Schema validation failed:
- Value '{'request': {'data': {'forceLogin': False, 'password': '****', 'thirdPartyLogin': False, 'username': '****'}, 'headers': {'content-type': 'application/x-www-form-urlencoded'}, 'method': 'POST', 'url': 'https://localhost:8443/api/authenticate'}, 'response': {'status_code': 200}}' is not a list. Value path: '/stages'.: Path: '/'>
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.51 seconds ===========================
It keeps talking about how the value is not a list which makes no sense to me. Thanks for taking the time to take a look at this and I look forward to your responses! :)