Add failing tests for #449: auth logout misleading message#461
Merged
gltanaka merged 4 commits intopromptdriven:mainfrom Feb 6, 2026
Merged
Add failing tests for #449: auth logout misleading message#461gltanaka merged 4 commits intopromptdriven:mainfrom
gltanaka merged 4 commits intopromptdriven:mainfrom
Conversation
…message Add unit and E2E tests that detect the bug where `pdd auth logout` displays "Logged out of PDD Cloud." even when not authenticated. Unit test (tests/test_commands_auth.py): - TestLogoutCommand class with 4 tests - Primary bug test: test_logout_when_not_authenticated_should_display_appropriate_message - 3 regression tests to ensure fix doesn't break existing functionality E2E test (tests/test_e2e_issue_449_auth_logout_message.py): - Subprocess-based tests exercising full CLI path - Verifies inconsistency between logout and clear-cache commands - 5 tests total: 2 failing (detecting bug), 3 passing (regression) Tests verified to: - FAIL on current buggy code (as expected) - Will PASS once fix is applied Related to promptdriven#449
…istent with clear-cache) Fixes promptdriven#449
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #449 where pdd auth logout displays a misleading success message when the user is not authenticated, making it inconsistent with the pdd auth clear-cache command's behavior.
Changes:
- Added authentication check in
logout_cmd()to display "Not authenticated." when user is not logged in - Added comprehensive test suite with 4 unit tests and 5 E2E tests to verify the fix and prevent regressions
- Tests verify both the bug fix and ensure normal logout functionality remains intact
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pdd/commands/auth.py | Added authentication status check before logout to prevent misleading success message |
| tests/test_commands_auth.py | Added 4 unit tests for logout command behavior with mocked dependencies |
| tests/test_e2e_issue_449_auth_logout_message.py | Added 5 E2E subprocess-based tests verifying the fix in real CLI scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix capitalization: "Subprocess-based" → "subprocess-based" for consistency - Extract duplicated `_run_pdd_command` to module-level function (DRY) - Shorten test method names for better readability: - test_logout_when_not_authenticated_should_display_appropriate_message → test_logout_not_authenticated_displays_message - test_logout_when_authenticated_with_valid_jwt_succeeds → test_logout_with_valid_jwt_succeeds - test_logout_when_authenticated_with_refresh_token_only_succeeds → test_logout_with_refresh_token_succeeds All tests pass after refactoring.
Contributor
Author
|
Addressed copilot comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the bug reported in #449 where
pdd auth logoutdisplays a misleading success message when the user is not authenticated.Changes
pdd/commands/auth.py- Added authentication check before logoutpdd/prompts/commands/auth_python.prompt- Prompt specification for auth moduleTest Files
tests/test_commands_auth.py(TestLogoutCommand class)tests/test_e2e_issue_449_auth_logout_message.pyThe Fix
Added authentication status check at the start of
logout_cmd():Test Results ✅
All tests now pass:
Unit Tests (tests/test_commands_auth.py)
test_logout_when_not_authenticated_should_display_appropriate_message- PASSES (bug fixed)test_logout_when_authenticated_with_valid_jwt_succeeds- PASSES (regression test)test_logout_when_authenticated_with_refresh_token_only_succeeds- PASSES (regression test)test_logout_handles_service_errors_gracefully- PASSES (regression test)E2E Tests (tests/test_e2e_issue_449_auth_logout_message.py)
test_logout_when_not_authenticated_should_display_appropriate_message- PASSES (bug fixed)test_logout_and_clear_cache_consistency- PASSES (consistency verified)test_clear_cache_when_no_cache_shows_appropriate_message- PASSES (documents correct behavior)test_logout_with_authentication_shows_success_message- PASSES (regression test)test_status_when_not_authenticated_shows_not_authenticated- PASSES (documents status command)Root Cause (Fixed)
The bug occurred because
logout_cmd()unconditionally displayed "Logged out of PDD Cloud." without checking authentication status first. The fix adds a check usingget_auth_status()to display "Not authenticated." when the user is not logged in, making the behavior consistent with theclear-cachecommand.Fixes #449
Generated by PDD agentic bug workflow + PDD agentic fix