9a5720e8ad
Branch Policy Check / Verify merge target (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
PR RC Release / Build RC Release (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Full namespace migration: update the Go module path and all import statements from git.mokoconsulting.tech to code.mokoconsulting.tech. Also updates all URL references in templates, workflows, configs, tests, and documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
package feed_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/unittest"
|
|
user_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/user"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/routers/web/feed"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/services/contexttest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
unittest.MainTest(m)
|
|
}
|
|
|
|
func TestCheckGetOrgFeedsAsOrgMember(t *testing.T) {
|
|
unittest.PrepareTestEnv(t)
|
|
t.Run("OrgMember", func(t *testing.T) {
|
|
ctx, resp := contexttest.MockContext(t, "org3.atom")
|
|
ctx.ContextUser = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3})
|
|
contexttest.LoadUser(t, ctx, 2)
|
|
feed.ShowUserFeedAtom(ctx)
|
|
assert.Contains(t, resp.Body.String(), "<entry>") // Should contain 1 private entry
|
|
})
|
|
t.Run("NonOrgMember", func(t *testing.T) {
|
|
ctx, resp := contexttest.MockContext(t, "org3.atom")
|
|
ctx.ContextUser = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3})
|
|
contexttest.LoadUser(t, ctx, 5)
|
|
feed.ShowUserFeedAtom(ctx)
|
|
assert.NotContains(t, resp.Body.String(), "<entry>") // Should not contain any entries
|
|
})
|
|
}
|