chore: add integration test
Demonstrate that the credential isn't shown in the flash message
This commit is contained in:
parent
145dea59bb
commit
d00200dc3e
3 changed files with 61 additions and 0 deletions
|
@ -0,0 +1,9 @@
|
|||
-
|
||||
id: 1001
|
||||
repo_id: 1
|
||||
interval: 3600
|
||||
enable_prune: false
|
||||
updated_unix: 0
|
||||
next_update_unix: 0
|
||||
lfs_enabled: false
|
||||
lfs_endpoint: ""
|
|
@ -0,0 +1,34 @@
|
|||
-
|
||||
id: 1001
|
||||
owner_id: 2
|
||||
owner_name: user2
|
||||
lower_name: repo1001
|
||||
name: repo1001
|
||||
default_branch: master
|
||||
original_url: https://:TOKEN@example.com/example/example.git
|
||||
num_watches: 0
|
||||
num_stars: 0
|
||||
num_forks: 0
|
||||
num_issues: 0
|
||||
num_closed_issues: 0
|
||||
num_pulls: 0
|
||||
num_closed_pulls: 0
|
||||
num_milestones: 0
|
||||
num_closed_milestones: 0
|
||||
num_projects: 0
|
||||
num_closed_projects: 0
|
||||
is_private: false
|
||||
is_empty: false
|
||||
is_archived: false
|
||||
is_mirror: true
|
||||
status: 0
|
||||
is_fork: false
|
||||
fork_id: 0
|
||||
is_template: false
|
||||
template_id: 0
|
||||
size: 0
|
||||
is_fsck_enabled: true
|
||||
close_issues_via_commit_in_any_branch: false
|
||||
created_unix: 1751320800
|
||||
updated_unix: 1751320800
|
||||
topics: '[]'
|
|
@ -1,9 +1,11 @@
|
|||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
|
@ -13,6 +15,7 @@ import (
|
|||
"forgejo.org/modules/git"
|
||||
"forgejo.org/modules/gitrepo"
|
||||
"forgejo.org/modules/migration"
|
||||
forgejo_context "forgejo.org/services/context"
|
||||
mirror_service "forgejo.org/services/mirror"
|
||||
release_service "forgejo.org/services/release"
|
||||
repo_service "forgejo.org/services/repository"
|
||||
|
@ -101,3 +104,18 @@ func TestMirrorPull(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
assert.Equal(t, initCount, count)
|
||||
}
|
||||
|
||||
func TestPullMirrorRedactCredentials(t *testing.T) {
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestPullMirrorRedactCredentials")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
session.MakeRequest(t, NewRequestWithValues(t, "POST", "/user2/repo1001/settings", map[string]string{
|
||||
"_csrf": GetCSRF(t, session, "/user2/repo1001/settings"),
|
||||
"action": "mirror-sync",
|
||||
}), http.StatusSeeOther)
|
||||
|
||||
flashCookie := session.GetCookie(forgejo_context.CookieNameFlash)
|
||||
assert.NotNil(t, flashCookie)
|
||||
assert.Equal(t, "info%3DPulling%2Bchanges%2Bfrom%2Bthe%2Bremote%2Bhttps%253A%252F%252Fexample.com%252Fexample%252Fexample.git%2Bat%2Bthe%2Bmoment.", flashCookie.Value)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue