Library for unittesting json REST apis built with pymacaron
Project description
pymacaron-unit
Python library for unittesting json REST apis built with pymacaron, including support for JWT authentication, Error formats used by pymacaron and compatible with 'pymtest', the testing tool used in pymacaron microservices.
Synopsis
from pymacaron_unit.testcase import PyMacaronTestCase
class Tests(PyMacaronTestCase):
def setUp(self):
super.setUp()
self.host = 'api.fixer.io'
self.port = 80
def test_make_some_calls(self):
# Test that GET returns a json structure
j = self.assertGetReturnJson(
"v1/hello",
)
# Same, with setting the Authorization http header to a JWT token
j = self.assertGetReturnJson(
"v1/hello",
auth="Bearer %s" % self.token
)
# Do a POST
j = self.assertPostReturnJson(
"v1/hello",
{
'foo': 'bar',
}
)
See pymacaron_unit/testcase.py for a complete list of test methods.
Examples
See test/test_unit.py :-)
Author
Erwan Lemonnier
github.com/pymacaron
github.com/erwan-lemonnier
www.linkedin.com/in/erwan-lemonnier/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymacaron-unit-1.0.20.tar.gz
(5.2 kB
view details)
File details
Details for the file pymacaron-unit-1.0.20.tar.gz
.
File metadata
- Download URL: pymacaron-unit-1.0.20.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.5.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe296e6000fbb623b8d8657dadfad58b60a8a26e55f71c908ac27b38c7de6b4 |
|
MD5 | a9fe8d9bf60c62df8f1f900d0ffb361a |
|
BLAKE2b-256 | df0881dda4daa8491db23b5858a7c7ccd9f54ab0bff5848d60630bbcf77315a5 |