2021-11-17 15:28:31 +05:30
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2021-11-17 15:28:31 +05:30
|
|
|
|
2022-06-15 12:32:00 +05:30
|
|
|
package user_test
|
2021-11-17 15:28:31 +05:30
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/unittest"
|
2022-06-15 12:32:00 +05:30
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
2021-11-17 15:28:31 +05:30
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIsFollowing(t *testing.T) {
|
|
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
2022-06-15 12:32:00 +05:30
|
|
|
assert.True(t, user_model.IsFollowing(4, 2))
|
|
|
|
assert.False(t, user_model.IsFollowing(2, 4))
|
|
|
|
assert.False(t, user_model.IsFollowing(5, unittest.NonexistentID))
|
|
|
|
assert.False(t, user_model.IsFollowing(unittest.NonexistentID, 5))
|
|
|
|
assert.False(t, user_model.IsFollowing(unittest.NonexistentID, unittest.NonexistentID))
|
2021-11-17 15:28:31 +05:30
|
|
|
}
|