mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix: address verified review findings (terminal-forms-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
21 files changed
+329
-53
No files matched your search
@@ -49,7 +49,7 @@ func TestPullCreateAgitPushesToMatchingRemoteWithoutRemoteFlag(t *testing.T) {
|
||||
switch {
|
||||
case r.URL.Path == "/api/v1/repos/alice/project":
|
||||
_, _ = w.Write([]byte(`{"full_name":"alice/project","default_branch":"main","permissions":{"push":true}}`))
|
||||
case strings.HasPrefix(r.URL.Path, "/api/v1/repos/alice/project/raw/"):
|
||||
case r.URL.Path == "/api/v1/orgs/alice", strings.HasPrefix(r.URL.Path, "/api/v1/repos/alice/project/raw/"):
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
case r.Method == http.MethodGet:
|
||||
_, _ = w.Write([]byte(`[]`))
|
||||
@@ -313,3 +313,15 @@ func TestCompareRefEscapesBranchNames(t *testing.T) {
|
||||
require.Equal(t, "fix%2312", compareRef("fix#12"))
|
||||
require.Equal(t, "bob:fix%25x", compareRef("bob:fix%x"))
|
||||
}
|
||||
|
||||
func TestPullCreateRefusesHeadEqualToBaseBeforePushing(t *testing.T) {
|
||||
creates := 0
|
||||
deps, runner, _ := publishCreateEnv(t, &creates)
|
||||
err := Execute(context.Background(), deps, []string{"pr", "create", "-R", "alice/project", "--title", "PR", "--head", "main", "--base", "main", "--no-input", "--yes"})
|
||||
require.Equal(t, clierr.Usage, clierr.ExitCode(err))
|
||||
require.ErrorContains(t, err, `must be on a branch named differently than "main"`)
|
||||
require.Zero(t, creates)
|
||||
for _, call := range runner.calls {
|
||||
require.NotContains(t, call, "push")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user