strip off spaces from git service command stdout

This commit is contained in:
jasquat 2022-12-12 10:05:08 -05:00
parent 1291c8d4e7
commit b8a5690c36
2 changed files with 19 additions and 1 deletions

View File

@ -115,7 +115,7 @@ class GitService:
result: subprocess.CompletedProcess[bytes] = cls.run_shell_command(
command, return_success_state=False
) # type: ignore
return result.stdout.decode("utf-8")
return result.stdout.decode("utf-8").strip()
@classmethod
def run_shell_command(

View File

@ -0,0 +1,18 @@
"""Process Model."""
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.services.git_service import GitService
class TestGitService(BaseTest):
def test_strips_output_of_stdout_from_command(
self,
app: Flask,
client: FlaskClient,
with_db_and_bpmn_file_cleanup: None,
) -> None:
output = GitService.run_shell_command_to_get_stdout(["echo", ' This output should not end in space or newline \n'])
assert output == 'This output should not end in space or newline'