-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the policy result to file_path (#704)
- Loading branch information
Showing
6 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
21 changes: 21 additions & 0 deletions
21
tests/unittest/cloud_governance/policy/policy_runners/common/test_abstract_policy_runner.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os.path | ||
import tempfile | ||
|
||
|
||
from cloud_governance.main.environment_variables import environment_variables | ||
from cloud_governance.policy.policy_runners.aws.policy_runner import PolicyRunner | ||
|
||
|
||
def test_write_to_file(): | ||
""" | ||
This method writes the data to the file | ||
:return: | ||
:rtype: | ||
""" | ||
with tempfile.TemporaryDirectory() as dir_name: | ||
environment_variables.environment_variables_dict['SAVE_TO_FILE_PATH'] = dir_name | ||
environment_variables.environment_variables_dict['policy'] = 'test' | ||
policy_runner = PolicyRunner() | ||
data = [{"ResourceId": "i-123"}, {"ResourceId": "i-456"}] | ||
policy_runner.write_to_file(data=data) | ||
assert os.path.getsize(f'{dir_name}/test.csv') > 1 |