From 5e5ead98dea6598459833d750b9ca76829b1f447 Mon Sep 17 00:00:00 2001 From: idubnori Date: Wed, 10 Apr 2024 22:36:15 +0900 Subject: [PATCH] test: rename & add error case --- ...t_github_output.py => test_github_action_output.py} | 10 ++++++++++ 1 file changed, 10 insertions(+) rename tests/unittest/{test_github_output.py => test_github_action_output.py} (77%) diff --git a/tests/unittest/test_github_output.py b/tests/unittest/test_github_action_output.py similarity index 77% rename from tests/unittest/test_github_output.py rename to tests/unittest/test_github_action_output.py index 10a2a02e..2b8e0db1 100644 --- a/tests/unittest/test_github_output.py +++ b/tests/unittest/test_github_action_output.py @@ -31,10 +31,20 @@ class TestGitHubOutput: assert not os.path.exists(str(tmp_path / 'output')) def test_github_action_output_notset(self, monkeypatch, tmp_path): + # not set config monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output')) output_data = {'key1': {'value1': 1, 'value2': 2}} key_name = 'key1' github_action_output(output_data, key_name) + assert not os.path.exists(str(tmp_path / 'output')) + + def test_github_action_output_error_case(self, monkeypatch, tmp_path): + monkeypatch.setenv('GITHUB_OUTPUT', str(tmp_path / 'output')) + output_data = None # invalid data + key_name = 'key1' + + github_action_output(output_data, key_name) + assert not os.path.exists(str(tmp_path / 'output')) \ No newline at end of file