1acf93d854
enable the golangci depguard lint rule: deny "models" and its sub packages in "modelmigration" package.
28 lines
967 B
Go
28 lines
967 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package repo_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
repo_model "gitea.dev/models/repo"
|
|
"gitea.dev/models/unittest"
|
|
"gitea.dev/modules/git/gitrepo"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRepository_GitRepo(t *testing.T) {
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
|
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
|
|
|
assert.Equal(t, "user2/repo1.git", gitrepo.CodeRepoByName(repo.OwnerName, repo.Name).GitRepoLocation())
|
|
assert.Equal(t, "user2/repo1.git", repo.CodeStorageRepo().GitRepoLocation())
|
|
assert.Equal(t, "repo-1", repo.CodeStorageRepo().GitRepoManagedID())
|
|
|
|
assert.Equal(t, "user2/repo1.wiki.git", gitrepo.WikiRepoByName(repo.OwnerName, repo.Name).GitRepoLocation())
|
|
assert.Equal(t, "user2/repo1.wiki.git", repo.WikiStorageRepo().GitRepoLocation())
|
|
assert.Equal(t, "repo-wiki-1", repo.WikiStorageRepo().GitRepoManagedID())
|
|
}
|