Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for static response data in mock Slack server #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gmr
Copy link

@gmr gmr commented Feb 10, 2025

Introduced a framework for serving static mock responses for specific Slack API endpoints using JSON files. Updated server infrastructure, handlers, and settings configuration to support this functionality, including response_data_path and appropriate endpoint routing. Enhanced the documentation with details on configuring and structuring response data.

This allowed me to easily add in endpoints for conversations.history, conversations.info, conversations.replies, and users.info which I needed for my testing.

In addition, I refactored a little to use logging instead of print statements, as it would have been helpful to debug my initial issues in getting up and running.

Finally I removed a little bit of duplicate Tornado RequestHandler code by moving request validation to prepare() method, ensuring all requests are validated upfront. This eliminates redundant validation checks in get() and post() methods and simplifies handler logic.

Let me know if you'd like to see any changes.

@gmr gmr force-pushed the additional-apis branch 3 times, most recently from 3af45d1 to 450fffa Compare February 11, 2025 01:21
@ygalblum
Copy link
Owner

@gmr Thanks for the contribution. Just a minor request, can you please squash the commits yourself so that you keep some of them separate if you see fit

gmr added 2 commits February 11, 2025 14:59
Move request validation to `prepare()` method, ensuring all requests are validated upfront. This eliminates redundant validation checks in `post()` methods and simplifies handler logic.

Signed-off-by: Gavin M. Roy <[email protected]>

Refactor logging to use `logging` module instead of `print`

Updated all modules to replace `print` statements with appropriate logging using the `logging` module. Introduced global loggers and added configurations to improve consistency and maintainability of log messages.

Signed-off-by: Gavin M. Roy <[email protected]>
Introduced a framework for serving static mock responses for specific Slack API endpoints using JSON files. Updated server infrastructure, handlers, and settings configuration to support this functionality, including `response_data_path` and appropriate endpoint routing. Enhanced the documentation with details on configuring and structuring response data.

Signed-off-by: Gavin M. Roy <[email protected]>
@ygalblum
Copy link
Owner

I took a look at why the tests are failing. The reason is that it is executed as a block-box container.
You can see the fixture podman_container in test_echo.py that starts the container and then the test interacts with it.
The CI builds the image as part of the test sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants