Skip to main content

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/

Metadata

Release files for pymacaron-unit 1.0.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymacaron-unit 1.0.20
File Size Uploaded
pymacaron-unit-1.0.20.tar.gz 5.2 kB Details

Release files / pymacaron-unit-1.0.20.tar.gz

Download URL pymacaron-unit-1.0.20.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bbe296e6000fbb623b8d8657dadfad58b60a8a26e55f71c908ac27b38c7de6b4
BLAKE2b-256 checksum
How to use checksums
df0881dda4daa8491db23b5858a7c7ccd9f54ab0bff5848d60630bbcf77315a5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.20 This release

1 release file

1.0.19

1 release file

1.0.18

1 release file

1.0.17

1 release file

1.0.16

1 release file

1.0.15

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page