2021-11-11 01:03:30 -06:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-11-12 08:36:47 -06:00
|
|
|
"code.gitea.io/gitea/models/unittest"
|
|
|
|
|
2021-11-11 01:03:30 -06:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLookupUserRedirect(t *testing.T) {
|
2021-11-12 08:36:47 -06:00
|
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
2021-11-11 01:03:30 -06:00
|
|
|
|
|
|
|
userID, err := LookupUserRedirect("olduser1")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.EqualValues(t, 1, userID)
|
|
|
|
|
|
|
|
_, err = LookupUserRedirect("doesnotexist")
|
|
|
|
assert.True(t, IsErrUserRedirectNotExist(err))
|
|
|
|
}
|