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.

39 lines
1023 B

  1. // Copyright 2017 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 integrations
  5. import (
  6. "bytes"
  7. "net/http"
  8. "net/url"
  9. "testing"
  10. "code.gitea.io/gitea/modules/setting"
  11. "github.com/stretchr/testify/assert"
  12. )
  13. func TestSignup(t *testing.T) {
  14. prepareTestEnv(t)
  15. setting.Service.EnableCaptcha = false
  16. req := NewRequestBody(t, "POST", "/user/sign_up",
  17. bytes.NewBufferString(url.Values{
  18. "user_name": []string{"exampleUser"},
  19. "email": []string{"exampleUser@example.com"},
  20. "password": []string{"examplePassword"},
  21. "retype": []string{"examplePassword"},
  22. }.Encode()),
  23. )
  24. req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
  25. resp := MakeRequest(req)
  26. assert.EqualValues(t, http.StatusFound, resp.HeaderCode)
  27. // should be able to view new user's page
  28. req = NewRequest(t, "GET", "/exampleUser")
  29. resp = MakeRequest(req)
  30. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  31. }