Skip to content

Refactoring and unit/e2e tests#50

Merged
soxoj merged 1 commit intomainfrom
refactoring-tests
Apr 9, 2026
Merged

Refactoring and unit/e2e tests#50
soxoj merged 1 commit intomainfrom
refactoring-tests

Conversation

@soxoj
Copy link
Copy Markdown
Collaborator

@soxoj soxoj commented Apr 7, 2026

Cleans up dead code in mailcat.py and adds a full test suite (unit + end-to-end).

mailcat.py — Dead code removal

  • Drop unused imports: base64, threading
  • Remove hardcoded 54-entry posteoLst from inside posteo() (duplicate of module-level list)
  • Remove unused walrus-operator assignments (exists, ct_exists, ukrnet_cookies, resp, exist)
  • Drop unused "hush_customerid" from Hushmail POST payload
  • not x in yx not in y (onet)

tests/conftest.py

  • Registers e2e marker; adds --e2e flag — e2e tests are skipped by default, keeping offline pytest fast

tests/test_mailcat.py — Unit tests (mocked)

  • Pure helper tests: randstr, stub_progress, create_task_func, CHECKERS sanity
  • Mocked async HTTP tests for all major provider checkers, covering both found/not-found paths

tests/test_e2e.py — End-to-end tests (real network)

  • Live checks against known-existing accounts (alex, soxoj) for all major providers
  • Only runs with pytest --e2e

.gitignore

  • Standard Python, venv, IDE, pytest, coverage, and Ruff entries

@soxoj
Copy link
Copy Markdown
Collaborator Author

soxoj commented Apr 7, 2026

@copilot please describe the changes made in this PR

Copy link
Copy Markdown

Copilot AI commented Apr 7, 2026

@copilot please describe the changes made in this PR

This PR makes the following changes:

mailcat.py — Code cleanup / refactoring

  • Removed unused imports: base64 and threading.
  • Removed a hardcoded 54-entry posteoLst domain list from inside the posteo() function body (the list is already defined elsewhere in the module).
  • Removed unused intermediate variables: exist (bigmir), resp (kolab — result was unused), ukrnet_cookies (walrus-operator assignment whose value was never used), and ct_exists / exists (ctemplar / mailRu — values were captured only to be used as a boolean).
  • Removed "hush_customerid" from the Hushmail POST payload (unused field).
  • Fixed a Python style issue: not x in yx not in y (onet).

tests/conftest.py — pytest configuration

  • Registers a custom e2e marker.
  • Adds a --e2e CLI flag; without it, all tests marked @pytest.mark.e2e are automatically skipped so the default pytest run stays fast and offline.

tests/test_mailcat.py — Unit tests (403 lines, ~mocked)

  • Tests for pure helpers: randstr, stub_progress, create_task_func, CHECKERS list sanity.
  • HTTP-mocked async tests for every major provider checker (Gmail, Yandex, Proton, MailRu, Posteo, DuckGo, emailn, Vivaldi, Firemail, Eclipso, Kolab, Bigmir, UkrNet, mail.de, hushmail, CTemplar, Onet, and more), covering both found and not-found code paths without hitting the real network.

tests/test_e2e.py — End-to-end tests (153 lines, real network)

  • Live network checks for the same provider functions using known-existing usernames (alex, soxoj).
  • Only executed when pytest --e2e is passed.

.gitignore — Expanded

  • Added standard Python, virtual-environment, IDE, pytest cache, coverage, and Ruff cache entries.

Copilot finished work on behalf of soxoj April 7, 2026 20:32
@soxoj soxoj merged commit afa5af5 into main Apr 9, 2026
1 check passed
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