From 547aadeb8ce2757eb95a72338f1233f7d6cae2cc Mon Sep 17 00:00:00 2001 From: Job79 Date: Sun, 16 Feb 2025 16:59:13 +0100 Subject: [PATCH] fix: add license --- routers/web/feed/profile_test.go | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 routers/web/feed/profile_test.go diff --git a/routers/web/feed/profile_test.go b/routers/web/feed/profile_test.go new file mode 100644 index 0000000000..84e6a82c35 --- /dev/null +++ b/routers/web/feed/profile_test.go @@ -0,0 +1,40 @@ +// Copyright 2025 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT +package feed_test + +import ( + "testing" + + "code.gitea.io/gitea/models/unittest" + user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/routers/web/feed" + "code.gitea.io/gitea/services/contexttest" + + "github.com/stretchr/testify/assert" +) + +func TestMain(m *testing.M) { + unittest.MainTest(m) +} + +func TestCheckGetOrgFeedsAsOrgMember(t *testing.T) { + unittest.PrepareTestEnv(t) + ctx, resp := contexttest.MockContext(t, "org3.atom") + ctx.ContextUser = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}) + contexttest.LoadUser(t, ctx, 2) + ctx.IsSigned = true + + feed.ShowUserFeedAtom(ctx) + assert.Contains(t, resp.Body.String(), "") // Should contain 1 private entry +} + +func TestCheckGetOrgFeedsAsNonOrgMember(t *testing.T) { + unittest.PrepareTestEnv(t) + ctx, resp := contexttest.MockContext(t, "org3.atom") + ctx.ContextUser = unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}) + contexttest.LoadUser(t, ctx, 5) + ctx.IsSigned = true + + feed.ShowUserFeedAtom(ctx) + assert.NotContains(t, resp.Body.String(), "") // Should not contain any entries +}