Skip to content

Generalize email domain handling in documentation and tests#27

Open
ret2libc wants to merge 2 commits intomainfrom
feature/generalize-email-domain
Open

Generalize email domain handling in documentation and tests#27
ret2libc wants to merge 2 commits intomainfrom
feature/generalize-email-domain

Conversation

@ret2libc
Copy link
Collaborator

Summary

  • Add .worktrees/ to .gitignore for git worktree support
  • Update _sanitize_email_for_username docstring to be domain-agnostic
  • Change CLAUDE.md example from trailofbits.com to example.com
  • Add tests for google.com, gmail.com, corporate subdomains, and plus addressing

The code already supported any email domain; this updates docs and tests to reflect that capability.

Test plan

  • All 19 tests in tests/test_api.py pass
  • ruff check passes
  • ty check passes
  • prek run --all-files passes

🤖 Generated with Claude Code

- Add .worktrees/ to .gitignore for git worktree support
- Update _sanitize_email_for_username docstring to be domain-agnostic
- Change CLAUDE.md example from trailofbits.com to example.com
- Add tests for google.com, gmail.com, corporate, and plus addressing

The code already supported any email domain; this updates docs and
tests to reflect that capability.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
dropkit/api.py Outdated
Sanitized username suitable for Linux user creation
"""
# Remove @trailofbits.com suffix (case insensitive)
# Remove @trailofbits.com suffix for backwards compatibility
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's needed because we just take the part before the @.
That could simply be a test instead

username = DigitalOceanAPI._sanitize_email_for_username("@trailofbits.com")
assert username == "user"

def test_sanitize_email_for_username_google(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add here the backtest for the @trailofbits.com usecase

Copy link
Collaborator

@DarkaMaul DarkaMaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nitpick - but nice catch!

- Remove redundant trailofbits.com regex, simplify to split("@")[0]
- Rename test to clarify backwards compatibility intent

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

3 participants