aminghadersohi opened a new pull request, #35779:
URL: https://github.com/apache/superset/pull/35779
### SUMMARY
This PR extracts the session ID retrieval logic in `CreateFormDataCommand`
into a separate `_get_session_id()` method that can be overridden in
subclasses. This improves testability and allows for custom session ID handling
in derived classes.
**Changes:**
- Extract `session.get('_id')` into `_get_session_id()` method in
`CreateFormDataCommand`
- Add docstring explaining the method can be overridden in subclasses
- Update `run()` method to use `self._get_session_id()` instead of directly
accessing session
- Add comprehensive unit tests covering:
- Default behavior (returns session ID from Flask session)
- Subclass override capability
- Integration with run() method for cache key generation
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - Backend refactoring with no UI changes
### TESTING INSTRUCTIONS
1. Run the new unit tests:
```bash
pytest tests/unit_tests/commands/explore/form_data/test_create.py -v
```
2. Verify all 3 tests pass
3. Run existing integration tests to ensure no regression:
```bash
pytest
tests/integration_tests/explore/form_data/commands_tests.py::TestCreateFormDataCommand
-v
```
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]