{"id":59482,"date":"2021-09-21T09:01:27","date_gmt":"2021-09-21T09:01:27","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=59482"},"modified":"2021-09-21T09:01:27","modified_gmt":"2021-09-21T09:01:27","slug":"3-ways-to-test-your-api-with-python","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=59482","title":{"rendered":"3 ways to test your API with Python"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" typeof=\"foaf:Image\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2021\/09\/puzzle_computer_solve_fix_tool.png\" width=\"1041\" height=\"584\" alt=\"Puzzle pieces coming together to form a computer screen\" title=\"Puzzle pieces coming together to form a computer screen\"><\/p>\n<p>In this tutorial, you&#8217;ll learn how to unit test code that performs HTTP requests. In other words, you&#8217;ll see the art of API unit testing in Python.<\/p>\n<p>Unit tests are meant to test a single unit of behavior. In testing, a well-known rule of thumb is to isolate code that reaches external dependencies.<\/p>\n<p>For instance, when testing a code that performs HTTP requests, it&#8217;s recommended to replace the real call with a fake call during test time. This way, you can unit test it without performing a real HTTP request every time you run the test.<\/p>\n<p><a href=\"https:\/\/opensource.com\/article\/21\/9\/unit-test-python\">read more<\/a><\/p>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to unit test code that performs HTTP requests. In other words, you&#8217;ll see the art of API unit testing in Python. Unit tests are meant to test a single unit of behavior. In testing, a well-known rule of thumb is to isolate code that reaches external dependencies. For instance, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":59483,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-59482","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/59482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59482"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/59482\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/59483"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}