Q & A
-
-
0
Nota -
0
Optiuni -
797
Accesari -
- NN
Ce este vcrpy?
- 5 years ago
- GNU/Linux.ro
- 5 years ago
Este un modul de Python, care implica cereri HTTP. Acesta inregistreaza toate interactiunile HTTP in fisiere text simplu (implicit intr-un fisier YAML). Acest lucru ajuta la scrierea testelor deterministe, si, de asemenea, ruleaza in offline.
Sa luam un test foarte simplu.
import unittest
import requests
class TestExample(unittest.TestCase):
def test_httpget(self):
r = requests.get("https://httpbin.org/get?name=vcrpy&lang=Python")
self.assertEqual(r.status_code, 200)
data = r.json()
self.assertEqual(data["args"]["name"], "vcrpy")
self.assertEqual(data["args"]["lang"], "Python")
if __name__ == "__main__":
unittest.main()
- Comenteaza
- powered by Verysign