fix: resolve CI linting and code quality issues

- Remove unused imports across all generator files
- Remove unused variables (spec, url_params, query_params, test_name)
- Fix f-strings without placeholders in auth.py and go.py
- Fix duplicate BASIC auth handling with wrong indentation
- Add missing pytest fixtures (sample_openapi_spec, temp_spec_file, temp_json_spec_file)
- Add missing TemplateRenderError import to generator files
This commit is contained in:
CI Bot
2026-02-06 07:05:58 +00:00
parent 839317c44b
commit 123a4f7d1d
8 changed files with 211 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
"""Authentication configuration for API TestGen."""
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Optional
from enum import Enum
from .exceptions import AuthConfigError, MissingSecuritySchemeError
@@ -293,21 +293,21 @@ func getAPIKeyHeaders() map[string]string {{
}}
'''
elif method["type"] == AuthType.BEARER:
return f'''
func getBearerHeaders() map[string]string {{
return map[string]string{{
return '''
func getBearerHeaders() map[string]string {
return map[string]string{
"Authorization": fmt.Sprintf("%s %s", os.Getenv("TOKEN_PREFIX"), os.Getenv("TOKEN")),
}}
}}
}
}
'''
elif method["type"] == AuthType.BASIC:
return f'''
func getBasicHeaders(username, password string) map[string]string {{
return '''
func getBasicHeaders(username, password string) map[string]string {
auth := username + ":" + password
encoded := base64.StdEncoding.EncodeToString([]byte(auth))
return map[string]string{{
return map[string]string{
"Authorization": "Basic " + encoded,
}}
}}
}
}
'''
return ""