1- .. pytest_httpserver documentation master file, created by
2- sphinx-quickstart on Sat Aug 11 08:07:37 2018.
3- You can adapt this file completely to your liking, but it should at least
4- contain the root `toctree` directive.
51
2+ pytest-httpserver
3+ =================
64
7- User's Guide
8- ------------
95pytest-httpserver is a python package which allows you to start a real HTTP server
106for your tests. The server can be configured programmatically to how to respond to
117requests.
@@ -22,8 +18,9 @@ This library can be used with pytest in the most convenient way but if you prefe
2218other test frameworks, you can still use it with the context API or by writing a wrapper
2319for it.
2420
25- Example with pytest
26- -------------------
21+
22+ Example
23+ -------
2724
2825.. code :: python
2926
@@ -34,44 +31,11 @@ Example with pytest
3431 assert requests.get(httpserver.url_for(" /foobar" )).json() == {' foo' : ' bar' }
3532
3633
37- Example without pytest
38- ----------------------
39-
40- .. code :: python
41-
42- import requests
43- import unittest
44- from pytest_httpserver import HTTPServer
45-
46- class TestJSONClient (unittest .TestCase ):
47- def setUp (self ):
48- self .httpserver = HTTPServer()
49- self .httpserver.start()
50-
51- def test_json_client (self ):
52- self .httpserver.expect_request(" /foobar" ).respond_with_json({" foo" : " bar" })
53- self .assertEqual(requests.get(self .httpserver.url_for(" /foobar" )).json(), {' foo' : ' bar' })
54-
55- def tearDown (self ):
56- self .httpserver.stop()
57-
58-
59- API Reference
60- -------------
61-
62- If you are looking for information on a specific function, class or
63- method, this part of the documentation is for you.
34+ For further details, please read the :doc: `guide ` or the :doc: `api `.
6435
6536.. toctree ::
66- :maxdepth: 2
67-
68- api
69-
70-
71-
72- Indices and tables
73- ==================
37+ :maxdepth: 1
7438
75- * :ref: ` genindex `
76- * :ref: ` modindex `
77- * :ref: ` search `
39+ guide
40+ api
41+ changes
0 commit comments