File: version_test.go

package info (click to toggle)
golang-code-gitea-sdk 0.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 760 kB
  • sloc: makefile: 107
file content (32 lines) | stat: -rw-r--r-- 956 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// 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 gitea

import (
	"log"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestVersion(t *testing.T) {
	log.Printf("== TestVersion ==")
	c := newTestClient()
	rawVersion, _, err := c.ServerVersion()
	assert.NoError(t, err)
	assert.True(t, true, rawVersion != "")

	assert.NoError(t, c.checkServerVersionGreaterThanOrEqual(version1_11_0))
	assert.Error(t, c.CheckServerVersionConstraint("< 1.11.0"))

	c.serverVersion = version1_11_0
	assert.Error(t, c.checkServerVersionGreaterThanOrEqual(version1_15_0))
	c.ignoreVersion = true
	assert.NoError(t, c.checkServerVersionGreaterThanOrEqual(version1_15_0))

	c, err = NewClient(getGiteaURL(), newTestClientAuth(), SetGiteaVersion("1.12.123"))
	assert.NoError(t, err)
	assert.NoError(t, c.CheckServerVersionConstraint("=1.12.123"))
}