mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:58:59 +01:00
88171e0030
[FEAT] add Forgejo Git Service (squash) register a Forgejo factory If the Forgejo factory for the Forgejo service is not registered, newDownloader will fallback to a git service and not migrate issues etc. Refs: https://codeberg.org/forgejo/forgejo/issues/1678 (cherry picked from commit51938cd161
) [FEAT] add Forgero Git Service Signed-off-by: cassiozareck <cassiomilczareck@gmail.com> (cherry picked from commita878adfe62
) Adding description and Forgejo SVG (cherry picked from commit13738c0380
) Undo reordering and tmpl redirection (cherry picked from commit9ae51c46f4
) (cherry picked from commit70fffdc61d
) (cherry picked from commitc0ebfa9da3
) (cherry picked from commit9922c92787
) (cherry picked from commit00c0effbc7
) (cherry picked from commite4c9525b13
) (cherry picked from commit09d7b83211
) (cherry picked from commitbbcd5975c9
) (cherry picked from commit55c70a0e18
) (cherry picked from commit76596410c0
) (cherry picked from commit1308043931
) (cherry picked from commit919d6aedfe
) [FEAT] add Forgero Git Service (squash) more tests Previously only Gitea service was being tested under self-hosted migrations. Since Forgejo is also self-hosted and in fact use the same downloader/migrator we can add to this suite another test that will do the same, migrating the same repository under the same local instance but for the Forgejo service (represented by 9) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1709 Co-authored-by: zareck <cassiomilczareck@gmail.com> Co-committed-by: zareck <cassiomilczareck@gmail.com> (cherry picked from commit40a4b8f1a8
) (cherry picked from commit3198b4a642
) (cherry picked from commit4edda1f389
) (cherry picked from commit4d91b77d29
) (cherry picked from commitafe85c52e3
) (cherry picked from commit5ea7df79ad
) (cherry picked from commita667182542
) (cherry picked from commita9bebb1e71
) (cherry picked from commit4831a89e46
) (cherry picked from commite02a74651f
) (cherry picked from commit05dcef59aa
) (cherry picked from commitc8bac187f9
) (cherry picked from commitc87903a0cc
)
39 lines
789 B
Go
39 lines
789 B
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package convert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestToCorrectPageSize(t *testing.T) {
|
|
assert.EqualValues(t, 30, ToCorrectPageSize(0))
|
|
assert.EqualValues(t, 30, ToCorrectPageSize(-10))
|
|
assert.EqualValues(t, 20, ToCorrectPageSize(20))
|
|
assert.EqualValues(t, 50, ToCorrectPageSize(100))
|
|
}
|
|
|
|
func TestToGitServiceType(t *testing.T) {
|
|
tc := []struct {
|
|
typ string
|
|
enum int
|
|
}{{
|
|
typ: "github", enum: 2,
|
|
}, {
|
|
typ: "gitea", enum: 3,
|
|
}, {
|
|
typ: "gitlab", enum: 4,
|
|
}, {
|
|
typ: "gogs", enum: 5,
|
|
}, {
|
|
typ: "forgejo", enum: 9,
|
|
}, {
|
|
typ: "trash", enum: 1,
|
|
}}
|
|
for _, test := range tc {
|
|
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
|
|
}
|
|
}
|