Skip to content

Commit

Permalink
Merge pull request #247 from mgoerens/apply_black
Browse files Browse the repository at this point in the history
Apply black and fix some PEP8 violations
  • Loading branch information
komish authored Aug 8, 2023
2 parents 671f21d + 8b71e3b commit ba8a8f2
Show file tree
Hide file tree
Showing 62 changed files with 4,841 additions and 2,237 deletions.
231 changes: 167 additions & 64 deletions scripts/src/chartprreview/chartprreview.py

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions scripts/src/chartprreview/chartprreview_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from chartprreview.chartprreview import check_owners_file_against_directory_structure
from chartprreview.chartprreview import write_error_log


def test_verify_user():
with pytest.raises(SystemExit):
verify_user("mbaiju", "partners", "test-org1", "test-chart")


owners_with_wrong_vendor_label = """\
---
chart:
Expand Down Expand Up @@ -51,21 +53,33 @@ def test_verify_user():
"""



def test_check_owners_file_against_directory_structure(tmpdir):
original_cwd = os.getcwd()
p = tmpdir.mkdir("charts").mkdir("partners").mkdir("test-org").mkdir("test-chart").join("OWNERS")
p = (
tmpdir.mkdir("charts")
.mkdir("partners")
.mkdir("test-org")
.mkdir("test-chart")
.join("OWNERS")
)
p.write(owners_with_wrong_vendor_label)
os.chdir(tmpdir)
new_cwd = os.getcwd()
print("new_cwd", new_cwd)
with pytest.raises(SystemExit):
check_owners_file_against_directory_structure("baijum", "partners", "test-org", "test-chart")
check_owners_file_against_directory_structure(
"baijum", "partners", "test-org", "test-chart"
)
p.write(owners_with_wrong_chart_name)
with pytest.raises(SystemExit):
check_owners_file_against_directory_structure("baijum", "partners", "test-org", "test-chart")
check_owners_file_against_directory_structure(
"baijum", "partners", "test-org", "test-chart"
)
p.write(owners_with_correct_values)
check_owners_file_against_directory_structure("baijum", "partners", "test-org", "test-chart")
check_owners_file_against_directory_structure(
"baijum", "partners", "test-org", "test-chart"
)


def test_write_error_log(tmpdir):
write_error_log(tmpdir, "First message")
Expand Down
Loading

0 comments on commit ba8a8f2

Please sign in to comment.