package globalapi

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/gin-gonic/gin"
	"github.com/stretchr/testify/assert"
	"github.com/tidbcloud/observability/pkg/common/errors"
)

func TestGetByocObservabilityVcpu_RejectNonByocBizType(t *testing.T) {
	gin.SetMode(gin.TestMode)

	w := httptest.NewRecorder()
	c, _ := gin.CreateTestContext(w)
	c.Request = httptest.NewRequest(http.MethodGet, "/api/v1/external/tidbcloud/orgs/1/byocVcpuPools/observabilityVcpu", nil)
	c.Params = gin.Params{{Key: "bizType", Value: "tidbcloud"}}

	GetByocObservabilityVcpu(c)

	assert.Equal(t, errors.UnsupportedBizType.GetHttpCode(), w.Code)
}
