Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending polarion_config parsing to accept token field #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/pyMetricCli/polarion.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __run_pypolarioncli(self, arguments) -> subprocess.CompletedProcess:
arguments (list): List of arguments to pass to pyPolarionCli.

Returns:
subprocess.CompletedProcess[bytes]: The result of the command.
subprocess.CompletedProcess[bytes]: The result of the command.
Includes return code, stdout and stderr.
"""
args = ["pyPolarionCli"] # The executable to run.
Expand Down Expand Up @@ -109,12 +109,17 @@ def search(self) -> dict:
f"{self.config['project']}_search_results.json")

command_list: list = ["--user", self.config["username"],
"--password", self.config["password"],
"--server", self.config["server"],
"search",
"--project", self.config["project"],
"--output", self.config["output"],
"--query", self.config["query"]]
"--password", self.config["password"]]

# Add token if available. pyPolarionCli will use it instead of the password if provided.
if "token" in self.config and self.config["token"]:
command_list += ["--token", self.config["token"]]

command_list += ["--server", self.config["server"],
"search",
"--project", self.config["project"],
"--output", self.config["output"],
"--query", self.config["query"]]

for field in self.config["fields"]:
command_list.append("--field")
Expand Down
Loading