Ich mag die Art, wie Fakeweb in Ruby verwendet werden kann, um HTTP-Anfragen beim Testen zu fälschen. Gibt es eine ähnliche Bibliothek oder eine Alternative für Python?Bibliothek wie Fakeweb für Python
8
A
Antwort
3
Siehe auch How can one mock/stub python module like urllib. Die Antwort, die Mox empfiehlt scheint am meisten wie Fakeweb, aber Mox können Sie gefälschte Versionen von jedem Modul, nicht nur urllib erstellen.
Wenn Ihr Webframework WebOb (repoze.bfg, Pylons andere) für eingehende Anfragen verwendet, können Sie webob.Request.blank
verwenden.
from webob import Request
r = Request.blank('/')
a_view_function(r)
1
Ich empfehle Ihnen, eine gefälschte Schnittstelle zu HTTP-Anfrage wie in questions 1016765 how-to-use-cookielib-with-httplib-in-python zu produzieren.
2
HTTPretty funktioniert genau wie FakeWeb. HTTPretty funktioniert in der Socket-Ebene, daher sollte es alle Python-HTTP-Client-Bibliotheken abfangen. Es ist Gefecht gegen Urllib2, httplib2 und Anfragen getestet
Verwandte Themen
- 1. Python-Bibliothek für XSS-Filterung?
- 2. Python-Bibliothek für Paketerstellung // Manipulation
- 3. Python-Bibliothek für Amazon MWS
- 4. Python-Bibliothek für jQuery-ähnliche Textextraktion?
- 5. Jede Python-Bibliothek erzeugt Regressionstabellen für Veröffentlichungsstile
- 6. Installation Python-Bibliothek für Mesos Version 0.28
- 7. Multi Threading für PuLP-Bibliothek in Python
- 8. Bayessche Spam-Filter-Bibliothek für Python
- 9. Git-Bibliothek für Ruby oder Python?
- 10. Python Jabber/XMPP-Client-Bibliothek für Twisted
- 11. Wie kann ich Boto-Bibliothek unter Windows für Python installieren?
- 12. So etwas wie Psyco-Bibliothek (Python) für Ruby, existiert?
- 13. Python Video-Bibliothek
- 14. Pure Python GUI Bibliothek?
- 15. Python: OAuth-Bibliothek
- 16. Python Exchange ActiveSync-Bibliothek
- 17. PubSub-Bibliothek für C#
- 18. Python Twitter-Bibliothek: welche?
- 19. Python-Nase: Assertion-Bibliothek?
- 20. Python "Block" -Bibliothek
- 21. Finanz-Python-Bibliothek
- 22. Sichere Python Markdown-Bibliothek
- 23. Gibt es für Python eine Bibliothek für Prim-verwandte Funktionen?
- 24. Python: Wie Schriftart mit Python-DOCX-Bibliothek festlegen?
- 25. Python - Bibliothek Probleme
- 26. Pure Python XSLT-Bibliothek
- 27. Jede DHCP-Python-Bibliothek?
- 28. XQuery-Bibliothek unter Python
- 29. Python und Bibliothek (WxPython)
- 30. Jsoup wie Bibliothek für Node.js
Ich kenne keine ähnliche lib. –