An API mocking tool
Project description
PyMoq is a tool for mocking HTTP services.
Usage
content = '{"author": "John Doe", "title": "Lorem ipsum dolor sit amet", "id": 1}' headers = { 'content-type': 'application/json; charset=utf-8', 'location': 'http://localhost:8090/books/1' } mock = pymoq.Mock(port=8090) mock.create_stub('/books', method='post').response(content, headers=headers, httpStatus=201) with mock.run(): response = requests.post('http://localhost:8090/books', data={"author": "John Doe", "title": "Lorem ipsum dolor sit amet"}) self.assertEqual(response.status_code, 201) self.assertEqual(response.headers['content-type'], 'application/json; charset=utf-8') self.assertEqual(response.headers['location'], 'http://localhost:8090/books/1') self.assertEqual(response.text, content)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
PyMoq-0.1.0-py3-none-any.whl
(4.8 kB
view hashes)