Merged duplicate create_external_session tests#18
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTest file refactor: removed a large multi-scenario Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/imio/esign/tests/test_utils.py (1)
569-577: Strengthen the no-files test by asserting no outbound POST is attempted.This test validates the return value, but it should also lock in the early-return behavior by asserting
requests.postis never called.♻️ Suggested test hardening
def test_create_external_session_no_files(self): """Returns _no_files_ when all file UIDs in the session resolve to nothing.""" signers = [("user1", "user1@sign.com", "User 1", "Position 1")] sid, session = add_files_to_session(signers, (self.uids[0],)) for i in range(len(session["files"])): session["files"][i]["uid"] = "nonexistent_uid_{}".format(i) - result = create_external_session(sid, esign_root_url="http://test.example.com") + with patch("imio.esign.utils.requests.post") as mock_post: + result = create_external_session(sid, esign_root_url="http://test.example.com") + mock_post.assert_not_called() self.assertEqual(result, "_no_files_")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/imio/esign/tests/test_utils.py` around lines 569 - 577, Update the test_create_external_session_no_files to also assert that no outbound POST is attempted: wrap the call to create_external_session with a mock/patch of the requests.post used by create_external_session (patch the requests.post symbol in the module that defines create_external_session, e.g., patch 'imio.esign.utils.requests.post'), call create_external_session(sid, esign_root_url=...), assert the return is "_no_files_", and then assert the mocked requests.post was never called; keep references to test_create_external_session_no_files, create_external_session and add_files_to_session to locate the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/imio/esign/tests/test_utils.py`:
- Around line 569-577: Update the test_create_external_session_no_files to also
assert that no outbound POST is attempted: wrap the call to
create_external_session with a mock/patch of the requests.post used by
create_external_session (patch the requests.post symbol in the module that
defines create_external_session, e.g., patch 'imio.esign.utils.requests.post'),
call create_external_session(sid, esign_root_url=...), assert the return is
"_no_files_", and then assert the mocked requests.post was never called; keep
references to test_create_external_session_no_files, create_external_session and
add_files_to_session to locate the code.
d14c99a to
ea863f7
Compare
|
Moved to test refactoring in #32 |
Summary by CodeRabbit