/
How to test endpoints and microservices with python

How to test endpoints and microservices with python

This sample script authenticates with the LMS and then uses the identity returned to interact with a microservice. This is similar to how a real user would interact with a microservice through an MFE. You can copy it, pull out the PIE service, and put in your own calls.

The useful things this does that you will want to steal for your own test script:

  • gets CSRF tokens so you can actually POST to various endpoints

  • hands the JWT identity cookies over to the microservice call

  • sets the magic header without which those identity cookies will not be picked up by the microservice

  • sets a few other headers needed by the endpoints

Services calling each other do not use this login method, so you will need to rebuild the script using a client ID and secret, similar to this OAuth Client script in postman.

Related content

How to authenticate and query edX APIs with Postman
How to authenticate and query edX APIs with Postman
More like this
Setup mockprock as a backend
Setup mockprock as a backend
More like this
Single endpoint tests
Single endpoint tests
More like this
Pact - Contract Testing
Pact - Contract Testing
More like this
How to: Set up a frontend app for sandbox testing using S3
How to: Set up a frontend app for sandbox testing using S3
More like this