mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-28 21:41:22 +08:00
Move createrepository from module to service layer (#26927)
Repository creation depends on many models, so moving it to service layer is better.
This commit is contained in:
@ -13,7 +13,7 @@ import (
|
||||
func Test_getLicense(t *testing.T) {
|
||||
type args struct {
|
||||
name string
|
||||
values *licenseValues
|
||||
values *LicenseValues
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@ -25,7 +25,7 @@ func Test_getLicense(t *testing.T) {
|
||||
name: "regular",
|
||||
args: args{
|
||||
name: "MIT",
|
||||
values: &licenseValues{Owner: "Gitea", Year: "2023"},
|
||||
values: &LicenseValues{Owner: "Gitea", Year: "2023"},
|
||||
},
|
||||
want: `MIT License
|
||||
|
||||
@ -49,11 +49,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := getLicense(tt.args.name, tt.args.values)
|
||||
if !tt.wantErr(t, err, fmt.Sprintf("getLicense(%v, %v)", tt.args.name, tt.args.values)) {
|
||||
got, err := GetLicense(tt.args.name, tt.args.values)
|
||||
if !tt.wantErr(t, err, fmt.Sprintf("GetLicense(%v, %v)", tt.args.name, tt.args.values)) {
|
||||
return
|
||||
}
|
||||
assert.Equalf(t, tt.want, string(got), "getLicense(%v, %v)", tt.args.name, tt.args.values)
|
||||
assert.Equalf(t, tt.want, string(got), "GetLicense(%v, %v)", tt.args.name, tt.args.values)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
func Test_fillLicensePlaceholder(t *testing.T) {
|
||||
type args struct {
|
||||
name string
|
||||
values *licenseValues
|
||||
values *LicenseValues
|
||||
origin string
|
||||
}
|
||||
tests := []struct {
|
||||
@ -73,7 +73,7 @@ func Test_fillLicensePlaceholder(t *testing.T) {
|
||||
name: "owner",
|
||||
args: args{
|
||||
name: "regular",
|
||||
values: &licenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
values: &LicenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
origin: `
|
||||
<name of author>
|
||||
<owner>
|
||||
@ -104,7 +104,7 @@ Gitea
|
||||
name: "email",
|
||||
args: args{
|
||||
name: "regular",
|
||||
values: &licenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
values: &LicenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
origin: `
|
||||
[EMAIL]
|
||||
`,
|
||||
@ -117,7 +117,7 @@ teabot@gitea.io
|
||||
name: "repo",
|
||||
args: args{
|
||||
name: "regular",
|
||||
values: &licenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
values: &LicenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
origin: `
|
||||
<program>
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
@ -132,7 +132,7 @@ gitea
|
||||
name: "year",
|
||||
args: args{
|
||||
name: "regular",
|
||||
values: &licenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
values: &LicenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
origin: `
|
||||
<year>
|
||||
[YEAR]
|
||||
@ -155,7 +155,7 @@ gitea
|
||||
name: "0BSD",
|
||||
args: args{
|
||||
name: "0BSD",
|
||||
values: &licenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
values: &LicenseValues{Year: "2023", Owner: "Gitea", Email: "teabot@gitea.io", Repo: "gitea"},
|
||||
origin: `
|
||||
Copyright (C) YEAR by AUTHOR EMAIL
|
||||
|
||||
|
Reference in New Issue
Block a user