1--- 2test_name: Check server stats 3 4strict: 5 - json:on 6 7stages: 8 - name: server_stats (json output) 9 request: 10 url: "http://{SAB_HOST}:{SAB_PORT}/sabnzbd/api" 11 method: GET 12 params: 13 mode: server_stats 14 apikey: "{SAB_APIKEY}" 15 output: json 16 response: 17 status_code: 200 18 headers: 19 content-type: !re_match "application/json" 20 content-type: !re_search "charset=(UTF|utf)-8" 21 json: 22 total: !anyint 23 month: !anyint 24 week: !anyint 25 day: !anyint 26 servers: !anydict 27 - total: !anyint 28 month: !anyint 29 week: !anyint 30 day: !anyint 31 daily: !anydict 32 33 - name: server_stats (text output) 34 request: 35 url: "http://{SAB_HOST}:{SAB_PORT}/sabnzbd/api" 36 method: GET 37 params: 38 mode: server_stats 39 apikey: "{SAB_APIKEY}" 40 output: text 41 response: 42 headers: 43 content-type: !re_match "text/plain" 44 content-type: !re_search "charset=(UTF|utf)-8" 45 pragma: "no-cache" 46 access-control-allow-origin: "*" 47 content-length: !re_match "[0-9]+" 48 status_code: 200 49 verify_response_with: 50 function: tavern.testutils.helpers:validate_regex 51 extra_kwargs: 52 expression: "{{(?=.*'total': [0-9]+)(?=.*'month': [0-9]+)(?=.*'week': [0-9]+)(?=.*'day': [0-9]+)(?=.*'servers': .*).*}}" 53 54 - name: server_stats (xml output) 55 request: 56 url: "http://{SAB_HOST}:{SAB_PORT}/sabnzbd/api" 57 method: GET 58 params: 59 mode: server_stats 60 apikey: "{SAB_APIKEY}" 61 output: xml 62 response: 63 headers: 64 content-type: !re_match "text/xml" 65 content-type: !re_search "charset=(UTF|utf)-8" 66 pragma: "no-cache" 67 access-control-allow-origin: "*" 68 content-length: !re_match "[0-9]+" 69 status_code: 200 70 verify_response_with: 71 function: tavalidate:assert_xml 72 extra_kwargs: 73 expected: | 74 <?xml version="1.0" encoding="UTF-8" ?> 75 <result> 76 <total>!anyint</total> 77 <month>!anyint</month> 78 <week>!anyint</week> 79 <day>!anyint</day> 80 <servers>!anything</servers> 81 </result> 82