Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

version_test.go 849B

1234567891011121314151617181920212223242526272829303132333435
  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. "encoding/json"
  8. "net/http"
  9. "testing"
  10. "code.gitea.io/gitea/models"
  11. "code.gitea.io/gitea/modules/setting"
  12. "code.gitea.io/sdk/gitea"
  13. "github.com/stretchr/testify/assert"
  14. )
  15. func TestVersion(t *testing.T) {
  16. assert.NoError(t, models.LoadFixtures())
  17. setting.AppVer = "1.1.0+dev"
  18. req, err := http.NewRequest("GET", "/api/v1/version", nil)
  19. assert.NoError(t, err)
  20. resp := MakeRequest(req)
  21. var version gitea.ServerVersion
  22. decoder := json.NewDecoder(bytes.NewBuffer(resp.Body))
  23. assert.NoError(t, decoder.Decode(&version))
  24. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  25. assert.Equal(t, setting.AppVer, string(version.Version))
  26. }