接口鉴权
作者:
七月尾巴_葵花 | 来源:发表于
2017-10-21 13:19 被阅读141次# coding=utf-8
import json
import requests
import unittest
from requests.auth import HTTPBasicAuth
class JenkinsGetTestCase(unittest.TestCase):
def setUp(self):
self.r = requests.get('http://192.168.217.130:8080/jenkins/api/json?tree=jobs[name]')
def test_getAllJobsName(self):
result = self.r.text
json_result = json.loads(result)
print json_result
self.assertEqual(json_result['jobs'][0]['name'], 'check_python_version')
def test_getAllJobsNameSimple(self):
json_result = self.r.json()
self.assertEqual(json_result['jobs'][0]['name'], 'check_python_version')
# 测试开启鉴权的接口-禁用某个job
if __name__ == '__main__':
unittest.main()
本文标题:接口鉴权
本文链接:https://www.haomeiwen.com/subject/fsebuxtx.html
网友评论