File: tango_test.go

package info (click to toggle)
golang-github-appleboy-gofight 2.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: makefile: 50
file content (25 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (2)
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
package example

import (
	"fmt"
	"net/http"
	"testing"

	"gitea.com/lunny/tango"
	"github.com/appleboy/gofight/v2"
	"github.com/stretchr/testify/assert"
)

func TestTangoHelloWorld(t *testing.T) {
	tan := tango.New(tango.Return())
	tan.Get("/", new(HelloAction))

	r := gofight.New()
	r.GET("/").
		SetDebug(true).
		Run(tan, func(rp gofight.HTTPResponse, rq gofight.HTTPRequest) {
			fmt.Println(rp.Code)
			assert.Equal(t, "Hello, World", rp.Body.String())
			assert.Equal(t, http.StatusOK, rp.Code)
		})
}