Michael Freno d53b8ec8bc FRE-4694: Add CLI command end-to-end tests
Add comprehensive e2e tests for all CLI commands with mocked API
responses. Fix test infrastructure to handle global state (os.Stdout
capture, HOME env var) and broken test parallelism in stdout-capturing
tests.

- Add testutil_test.go with runFreshCommand, setupE2E, mockAPIServer
- Add e2e_full_test.go with ~40 tests covering auth, mail, contacts,
  attachments, folders, labels, drafts, help output
- Add newRootCmdBase() for fresh command trees per test
- Remove t.Parallel() from stdout-capturing and HOME-dependent tests
- Fix SessionWithMockSession to use runFreshCommand (stdout capture)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-04 01:08:26 -04:00
2026-04-29 16:30:29 -04:00
2026-04-27 19:13:03 -04:00
2026-04-27 19:13:03 -04:00
2026-04-29 16:30:29 -04:00

pop

A ProtonMail CLI tool written in Go, similar to gog.

Features

  • Authentication: Interactive login/logout with 2FA support and masked password prompts
  • Session Management: Secure token storage in ~/.config/pop/
  • ProtonMail API Client: REST client with rate limiting and error handling
  • PGP Encryption: Full support for ProtonMail's PGP encryption via gopenpgp v2

Installation

# Build from source
git clone https://github.com/frenocorp/pop.git
cd pop
make build

# Install
make install

Usage

# Initialize login (interactive mode with masked password prompt)
pop login

# Check current session
pop session

# Logout
pop logout

Project Structure

pop/
├── cmd/
│   ├── root.go       # CLI root command
│   └── auth.go       # Authentication commands
├── internal/
│   ├── auth/         # Session management
│   │   └── session.go
│   ├── config/       # Configuration handling
│   │   └── config.go
│   └── api/          # ProtonMail API client
│       └── client.go
├── .github/
│   └── workflows/
│       └── ci.yml    # CI/CD pipeline
├── go.mod
├── go.sum
├── main.go
├── Makefile
└── README.md

Configuration

Configuration is stored in ~/.config/pop/config.json:

{
  "api_base_url": "https://api.protonmail.ch",
  "timeout_sec": 30,
  "rate_limit_requests": 100,
  "rate_limit_window_sec": 60
}

Session data is stored in ~/.config/pop/session.json:

{
  "uid": "user-uid",
  "access_token": "token",
  "refresh_token": "refresh",
  "expires_at": 0,
  "two_factor_enabled": false
}

Development

# Build
make build

# Run tests
make test

# Format code
make fmt

# Lint
make lint

# Clean build artifacts
make clean

Dependencies

License

MIT

Description
No description provided
Readme 245 KiB
Languages
Go 99.9%
Makefile 0.1%