ansys / ansys/openapi-common

Add a MockedApiClient and/or MockedApiClientFactory classes

Open
#153 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
Avg merge
6h 15m
Merged PRs (30d)
24

Description

It's going to be quite a common occurrence for packages that depend on openapi-common to want to mock connections to test with canned responses. Instead of forcing every dependent package to write their own boilerplate code to do this, it would be nice to add this as functionality to this library.

For example, expose something like:

```python
from ansys.openapi.common import testing

cxn = testing.ApiClientFactory('http://localhost").connect()
cxn.register_response(my_canned_response)
result = cxn.run(query) # Returns my_canned_response
```

I'm not suggesting that as the actual interface, there's probably a lot more complexity that's required. But something like that would help mocking out connections to remote resources for package authors.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.