Skip to content

Commit 25d3627

Browse files
committed
Fix unit test error that caused test to break; fix salesforce#231 by writing the file as utf-8 by default even for windows
1 parent df02b4a commit 25d3627

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

cloudsplaining/command/scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def scan(
115115
if os.path.exists(html_output_file):
116116
os.remove(html_output_file)
117117

118-
with open(html_output_file, "w") as f:
118+
with open(html_output_file, "w", encoding="utf-8") as f:
119119
f.write(rendered_html_report)
120120

121121
print(f"Wrote HTML results to: {html_output_file}")
-3.78 MB
Loading

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ verbosity=2
55

66
[tool:pytest]
77
testpaths = test test/command test/scanning test/output test/shared
8-
verbosity=2
98
python_files=test/*/test_*.py
10-
ignore= __pycache__ *.pyc
119
norecursedirs = .svn _build tmp* __pycache__
1210

1311
# Exclude: __pycache__ / .pyc

test/scanning/test_policy_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_all_allowed_unrestriced_deny(self):
122122
}
123123
policy_document = PolicyDocument(test_policy)
124124
result = policy_document.all_allowed_unrestricted_actions
125-
self.assertEquals([],result)
125+
self.assertEqual([],result)
126126

127127
def test_policy_document_all_allowed_actions_deny(self):
128128
"""scan.policy_document.all_allowed_actions"""

test/scanning/test_statement_detail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
import json
23
from cloudsplaining.scan.statement_detail import StatementDetail
34
from cloudsplaining.shared.exclusions import is_name_excluded, Exclusions, DEFAULT_EXCLUSIONS
45

@@ -184,7 +185,6 @@ def test_statement_details_for_allow_not_action(self):
184185
results = statement.not_action_effective_actions
185186
# We excluded everything else besides TagResource on purpose. Not a typical pattern
186187
# but easier to maintain with unit tests
187-
import json
188188
print(json.dumps(results, indent=4))
189189
# Future proofing this unit test
190190
expected_actions = [
@@ -227,7 +227,7 @@ def test_statement_details_for_allow_not_action(self):
227227
this_statement = {
228228
"Sid": "VisualEditor0",
229229
"Effect": "Deny",
230-
"NotAction": [
230+
"Action": [
231231
"iam:*",
232232
],
233233
"Resource": [
@@ -243,7 +243,7 @@ def test_statement_details_for_allow_not_action(self):
243243
this_statement = {
244244
"Sid": "VisualEditor0",
245245
"Effect": "Deny",
246-
"NotAction": [
246+
"Action": [
247247
"iam:*",
248248
],
249249
"Resource": [

0 commit comments

Comments
 (0)