You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

redirect_test.go 576B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import (
  6. "testing"
  7. "code.gitea.io/gitea/models/unittest"
  8. "github.com/stretchr/testify/assert"
  9. )
  10. func TestLookupUserRedirect(t *testing.T) {
  11. assert.NoError(t, unittest.PrepareTestDatabase())
  12. userID, err := LookupUserRedirect("olduser1")
  13. assert.NoError(t, err)
  14. assert.EqualValues(t, 1, userID)
  15. _, err = LookupUserRedirect("doesnotexist")
  16. assert.True(t, IsErrUserRedirectNotExist(err))
  17. }