Skip to content

Commit d54cba2

Browse files
committed
additional test case
1 parent 8e5c025 commit d54cba2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

deep_code/tests/tools/test_publish.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,29 @@ def test_publish_nothing_to_publish_raises(
151151
mock_publish_dataset.assert_called_once()
152152
mock_generate_workflow_experiment_records.assert_not_called()
153153

154+
@patch.object(Publisher, "publish_dataset", return_value={"x": {}})
155+
@patch.object(
156+
Publisher, "generate_workflow_experiment_records", return_value={"y": {}}
157+
)
158+
def test_publish_builds_pr_params(self, mock_wf, mock_ds):
159+
# Make PR creation return a fixed URL
160+
self.publisher.gh_publisher.publish_files.return_value = "PR_URL"
161+
162+
# Provide IDs for commit/PR labels
163+
self.publisher.collection_id = "col"
164+
self.publisher.workflow_id = "wf"
165+
166+
url = self.publisher.publish(write_to_file=False, mode="all")
167+
assert url == "PR_URL"
168+
169+
# Inspect the call arguments to publish_files
170+
_, kwargs = self.publisher.gh_publisher.publish_files.call_args
171+
assert "dataset: col" in kwargs["commit_message"]
172+
assert "workflow/experiment: wf" in kwargs["commit_message"]
173+
assert "dataset: col" in kwargs["pr_title"]
174+
assert "workflow/experiment: wf" in kwargs["pr_title"]
175+
176+
154177
class TestParseGithubNotebookUrl:
155178
@pytest.mark.parametrize(
156179
"url,repo_url,repo_name,branch,file_path",

0 commit comments

Comments
 (0)