Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply black and fix some PEP8 violations #247

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading