From 2b1cccae491571ce19dea972f7208ac3664aeb1e Mon Sep 17 00:00:00 2001 From: Samriddhi Singh Date: Wed, 10 Jul 2024 16:24:38 +0530 Subject: [PATCH] Fix linting --- src/tirith/cli.py | 5 ++--- tests/core/test_end_to_end.py | 12 +++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/tirith/cli.py b/src/tirith/cli.py index 67e91ef..652c0dd 100755 --- a/src/tirith/cli.py +++ b/src/tirith/cli.py @@ -112,8 +112,7 @@ def __init__(self, prog="PROG") -> None: try: result = start_policy_evaluation(args.policyPath, args.inputPath) - - + if args.json: formatted_result = json.dumps(result, indent=3) print(formatted_result) @@ -122,7 +121,7 @@ def __init__(self, prog="PROG") -> None: if result["final_result"] == False: return ExitStatus.ERROR - + return ExitStatus.SUCCESS except Exception as e: # TODO:write an exception class for all provider exceptions. diff --git a/tests/core/test_end_to_end.py b/tests/core/test_end_to_end.py index 87c12a6..f38a30f 100644 --- a/tests/core/test_end_to_end.py +++ b/tests/core/test_end_to_end.py @@ -1,19 +1,21 @@ -import pytest +import pytest import subprocess import os def run_cmd(command): - process = subprocess.Popen(command,stdout=subprocess.PIPE, stdin= subprocess.PIPE, shell = True) + process = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) stdout, stderr = process.communicate() - + return process.returncode + def test_end_to_end(): - policy_file_name = f"{os.path.dirname(os.path.abspath(__file__))}/fixtures/apigateway_state_logging_enabled.tirith.json" + policy_file_name = ( + f"{os.path.dirname(os.path.abspath(__file__))}/fixtures/apigateway_state_logging_enabled.tirith.json" + ) input_file_name = f"{os.path.dirname(os.path.abspath(__file__))}/fixtures/plan.json" command = f"tirith -policy-path {policy_file_name} -input-path {input_file_name}" returncode = run_cmd(command) assert returncode == 1 -