package main

import (
	"net/http"
	"sparrow/pkg/models"
	"testing"

	"github.com/kataras/iris/httptest"
)

func TestRoleCreate(t *testing.T) {
	*confDBPass = "123456"
	e := httptest.New(t, newApp())
	// get token
	tk := getToken()
	e.POST("/api/v1/admin/role").WithHeader("Authorization", "Bearer "+tk).
		WithJSON(models.Role{
			RoleCode: 0,
			RoleName: "普通用户",
			MenuList: "home",
		}).
		Expect().Status(http.StatusOK).
		JSON().Object().Values().Contains(0)
}
