labd / commercetools-python-sdk

Commercetools Python SDK
https://commercetools-python-sdk.readthedocs.io/en/latest/
MIT License
17 stars 16 forks source link

Implement token introspection mock endpoint #64

Closed mbarga closed 5 years ago

mbarga commented 5 years ago

Purpose:

My team has been playing around with using the labd mock commercetools server in our integration testing. We use the commercetools introspection endpoint and noticed that it wasn't yet implemented in the labd mock server.

In this pull request, I have added a mock introspect method on the AuthBackend class. It accepts a client_id and client_secret from the authorization headers, and a token from the request body. It then checks if this token has previously been generated and stored in the model self.tokens list, and returns an appropriate active or inactive response.

For context, this endpoint implements Auth 2.0 supported Token Introspection.

codecov[bot] commented 5 years ago

Codecov Report

Merging #64 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #64   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files          35       35           
  Lines         849      849           
=======================================
  Hits          845      845           
  Misses          4        4

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8b42d2c...76f3191. Read the comment docs.

codecov-io commented 5 years ago

Codecov Report

Merging #64 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #64   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files          35       35           
  Lines         849      849           
=======================================
  Hits          845      845           
  Misses          4        4

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8b42d2c...692113b. Read the comment docs.