def test_pr_create_is_not_fork(self, github_project, fork_username): github_project.should_receive("is_fork").and_return(False) GithubPullRequest.should_receive("__init__").and_return() head = ":".join(filter(None, [fork_username, "master"])) github_project.github_repo.should_call("create_pull").with_args( title="test_title", body="test_content", base="master", head=head) github_project.parent.github_repo.should_call("create_pull").never() github_project.github_repo.should_call("create_pull").once() github_project.pr_create( title="test_title", body="test_content", target_branch="master", source_branch="master", fork_username=fork_username, )
def test_pr_create_is_fork(self, github_project, fork_username): github_project.should_receive("is_fork").and_return(True) GithubPullRequest.should_receive("__init__").and_return() github_project.parent.github_repo.should_call("create_pull").with_args( title="test_title", body="test_content", base="master", head=f"{github_project}:master", ) github_project.parent.github_repo.should_call("create_pull").once() github_project.github_repo.should_call("create_pull").never() github_project.pr_create( title="test_title", body="test_content", target_branch="master", source_branch="master", fork_username=fork_username, )