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:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user