<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          betamaxHTTP 交互模擬庫

          聯(lián)合創(chuàng)作 · 2023-10-01 18:05

          Betamax 是 VCR 的模仿,用于 HTTP 請求。使用方法:

          from betamax import Betamax
          from requests import Session
          from unittest import TestCase
          
          with Betamax.configure() as config:
              config.cassette_library_dir = 'tests/fixtures/cassettes'
          
          
          class TestGitHubAPI(TestCase):
              def setUp(self):
                  self.session = Session()
                  self.headers.update(...)
          
              # Set the cassette in a line other than the context declaration
              def test_user(self):
                  with Betamax(self.session) as vcr:
                      vcr.use_cassette('user')
                      resp = self.session.get('https://api.github.com/user',
                                              auth=('user', 'pass'))
                      assert resp.json()['login'] is not None
          
              # Set the cassette in line with the context declaration
              def test_repo(self):
                  with Betamax(self.session).use_cassette('repo'):
                      resp = self.session.get(
                          'https://api.github.com/repos/sigmavirus24/github3.py'
                          )
                      assert resp.json()['owner'] != {}
          瀏覽 14
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  久草福利 | 久久澡狠l澡欧美老妇 | 999国产精品999久久久久久 | 天天干,一区二区 | 中国免费看毛片 |