package apitokens

import (
	"net/http"
	"testing"
)

func TestRequirementForAIChatCompletions(t *testing.T) {
	req, ok := RequirementForRequest(http.MethodPost, "/api/v1/ai/chat/completions", "")
	if !ok {
		t.Fatal("expected requirement")
	}
	if req.Resource != "automation.chat" || !req.Write {
		t.Fatalf("unexpected requirement: %+v", req)
	}
}

func TestRequirementForAIQuotaRead(t *testing.T) {
	req, ok := RequirementForRequest(http.MethodGet, "/api/v1/ai/quota", "")
	if !ok {
		t.Fatal("expected requirement")
	}
	if req.Resource != "automation.chat" || req.Write {
		t.Fatalf("unexpected requirement: %+v", req)
	}
}
