Skip to content

Commit 36a2d2f

Browse files
authored
Add a simple test for external renderer (#20033)
Fix #16402
1 parent 6398ca7 commit 36a2d2f

File tree

24 files changed

+178
-9
lines changed

24 files changed

+178
-9
lines changed

models/db/iterate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestIterate(t *testing.T) {
2525
return nil
2626
})
2727
assert.NoError(t, err)
28-
assert.EqualValues(t, 79, repoCnt)
28+
assert.EqualValues(t, 80, repoCnt)
2929

3030
err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repoUnit *repo_model.RepoUnit) error {
3131
reopUnit2 := repo_model.RepoUnit{ID: repoUnit.ID}

models/fixtures/repo_unit.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,3 +544,9 @@
544544
repo_id: 51
545545
type: 2
546546
created_unix: 946684810
547+
548+
-
549+
id: 80
550+
repo_id: 53
551+
type: 1
552+
created_unix: 946684810

models/fixtures/repository.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,3 +1558,30 @@
15581558
size: 0
15591559
is_fsck_enabled: true
15601560
close_issues_via_commit_in_any_branch: false
1561+
1562+
-
1563+
id: 53
1564+
owner_id: 30
1565+
owner_name: user30
1566+
lower_name: renderer
1567+
name: renderer
1568+
is_archived: false
1569+
is_empty: false
1570+
is_private: false
1571+
num_issues: 0
1572+
num_closed_issues: 0
1573+
num_pulls: 0
1574+
num_closed_pulls: 0
1575+
num_milestones: 0
1576+
num_closed_milestones: 0
1577+
num_watches: 0
1578+
num_projects: 0
1579+
num_closed_projects: 0
1580+
status: 0
1581+
is_fork: false
1582+
fork_id: 0
1583+
is_template: false
1584+
template_id: 0
1585+
size: 0
1586+
is_fsck_enabled: true
1587+
close_issues_via_commit_in_any_branch: false

models/fixtures/user.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@
11021102
num_followers: 0
11031103
num_following: 0
11041104
num_stars: 0
1105-
num_repos: 3
1105+
num_repos: 4
11061106
num_teams: 0
11071107
num_members: 0
11081108
visibility: 0

models/repo/repo_list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ func TestSearchRepository(t *testing.T) {
235235
{
236236
name: "AllPublic/PublicRepositoriesOfUserIncludingCollaborative",
237237
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 15, AllPublic: true, Template: util.OptionalBoolFalse},
238-
count: 28,
238+
count: 29,
239239
},
240240
{
241241
name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative",
242242
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 15, Private: true, AllPublic: true, AllLimited: true, Template: util.OptionalBoolFalse},
243-
count: 33,
243+
count: 34,
244244
},
245245
{
246246
name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName",
@@ -255,7 +255,7 @@ func TestSearchRepository(t *testing.T) {
255255
{
256256
name: "AllPublic/PublicRepositoriesOfOrganization",
257257
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 17, AllPublic: true, Collaborate: util.OptionalBoolFalse, Template: util.OptionalBoolFalse},
258-
count: 28,
258+
count: 29,
259259
},
260260
{
261261
name: "AllTemplates",

routers/web/user/home_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestArchivedIssues(t *testing.T) {
2626

2727
// Assume: User 30 has access to two Repos with Issues, one of the Repos being archived.
2828
repos, _, _ := repo_model.GetUserRepositories(&repo_model.SearchRepoOptions{Actor: ctx.Doer})
29-
assert.Len(t, repos, 2)
29+
assert.Len(t, repos, 3)
3030
IsArchived := make(map[int64]bool)
3131
NumIssues := make(map[int64]int)
3232
for _, repo := range repos {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/master
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[core]
2+
repositoryformatversion = 0
3+
filemode = true
4+
bare = true
5+
ignorecase = true
6+
precomposeunicode = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The repository will be used to test third-party renderer in TestExternalMarkupRenderer
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
data=$(cat)
3+
exitcodes=""
4+
hookname=$(basename $0)
5+
GIT_DIR=${GIT_DIR:-$(dirname $0)}
6+
7+
for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do
8+
test -x "${hook}" && test -f "${hook}" || continue
9+
echo "${data}" | "${hook}"
10+
exitcodes="${exitcodes} $?"
11+
done
12+
13+
for i in ${exitcodes}; do
14+
[ ${i} -eq 0 ] || exit ${i}
15+
done

0 commit comments

Comments
 (0)