This commit is contained in:
@@ -8,10 +8,11 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/options"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/tests"
|
||||
"gitea.dev/modules/options"
|
||||
repo_module "gitea.dev/modules/repository"
|
||||
"gitea.dev/modules/setting"
|
||||
api "gitea.dev/modules/structs"
|
||||
"gitea.dev/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -22,9 +23,12 @@ func TestAPIListLicenseTemplates(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/api/v1/licenses")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// This tests if the API returns a list of strings
|
||||
var licenseList []api.LicensesTemplateListEntry
|
||||
DecodeJSON(t, resp, &licenseList)
|
||||
licenseList := DecodeJSON(t, resp, []api.LicensesTemplateListEntry{})
|
||||
assert.Contains(t, licenseList, api.LicensesTemplateListEntry{
|
||||
Key: "MIT",
|
||||
Name: "MIT",
|
||||
URL: setting.AppURL + "api/v1/licenses/MIT",
|
||||
})
|
||||
}
|
||||
|
||||
func TestAPIGetLicenseTemplateInfo(t *testing.T) {
|
||||
@@ -42,8 +46,7 @@ func TestAPIGetLicenseTemplateInfo(t *testing.T) {
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var licenseInfo api.LicenseTemplateInfo
|
||||
DecodeJSON(t, resp, &licenseInfo)
|
||||
licenseInfo := DecodeJSON(t, resp, &api.LicenseTemplateInfo{})
|
||||
|
||||
// We get the text of the template here
|
||||
text, _ := options.License(licenseName)
|
||||
|
||||
Reference in New Issue
Block a user