Revert: remove Gettokens (#18908)

* Revert: remove Gettokens

* test_conn_fixes
This commit is contained in:
Suman Maharana 2024-12-04 11:57:18 +05:30 committed by GitHub
parent d634edb8f1
commit cf61df2404
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 17 deletions

View File

@ -152,24 +152,27 @@ class MSTRClient:
def is_project_name(self) -> bool:
return bool(self.config.projectName)
def list_projects(self) -> List[MstrProject]:
"""
Test if we can get the token and fetch projects
"""
self.get_auth_params()
resp_projects = self.client.get(
path="/projects",
)
return resp_projects
def get_projects_list(self) -> List[MstrProject]:
"""
Get List of all projects
"""
try:
resp_projects = self.client.get(
path="/projects",
)
project_list = MstrProjectList(projects=resp_projects)
project_list = MstrProjectList(projects=self.list_projects())
return project_list.projects
except Exception as exc:
logger.debug(traceback.format_exc())
logger.warning(f"Failed to fetch the project list due to [{exc}]")
return []
def get_project_by_name(self) -> Optional[MstrProject]:
"""
Get Project By Name

View File

@ -49,8 +49,7 @@ def test_connection(
"""
test_fn = {
"GetToken": client.get_auth_params,
"GetProjects": client.get_projects_list,
"GetProjects": client.list_projects,
}
return test_connection_steps(

View File

@ -3,13 +3,6 @@
"displayName": "Mstr Test Connection",
"description": "This Test Connection validates the access against the server and basic metadata extraction of dashboards and charts.",
"steps": [
{
"name": "GetToken",
"description": "Fetch the Auth Token",
"errorMessage": "Failed to fetch auth token, please validate the credentials or if user has access to fetch token or if you are using the correct login mode",
"shortCircuit": true,
"mandatory": true
},
{
"name": "GetProjects",
"description": "List all the projects available to the user",