"""Tests for token validator. Generated by generate-tests.py - Do not edit manually. """ from validators.token import TokenValidator class TestTokenValidator: """Test cases for TokenValidator.""" def setup_method(self): """Set up test fixtures.""" self.validator = TokenValidator("test-action") def teardown_method(self): """Clean up after tests.""" self.validator.clear_errors() def test_valid_github_token(self): """Test valid GitHub tokens.""" # Classic PAT (4 + 36 chars) assert self.validator.validate_github_token("ghp_" + "a" * 36) is True # Fine-grained PAT (82 chars) assert self.validator.validate_github_token("github_pat_" + "a" * 71) is True # GitHub expression assert self.validator.validate_github_token("${{ secrets.GITHUB_TOKEN }}") is True def test_invalid_github_token(self): """Test invalid GitHub tokens.""" assert self.validator.validate_github_token("invalid") is False assert self.validator.validate_github_token("ghp_short") is False assert self.validator.validate_github_token("", required=True) is False def test_other_token_types(self): """Test other token types.""" # NPM token assert self.validator.validate_npm_token("npm_" + "a" * 40) is True