<commit_before>package api_test

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

	"github.com/git-lfs/git-lfs/api"
	"github.com/git-lfs/git-lfs/endpoint"
	"github.com/stretchr/testify/assert"
)

func NewTestConfig() *config.Configuration {
	c := config.NewFrom(config.Values{})
	c.SetManualEndpoint(config.Endpoint{Url: "https://example.com"})
	return c
}

func TestHttpLifecycleMakesRequestsAgainstAbsolutePath(t *testing.T) {
	SetupTestCredentialsFunc()
	defer RestoreCredentialsFunc()

	l := api.NewHttpLifecycle(NewTestConfig())
	req, err := l.Build(&api.RequestSchema{
		Path:      "/foo",
		Operation: api.DownloadOperation,
	})

	assert.Nil(t, err)
	assert.Equal(t, "https://example.com/foo", req.URL.String())
}

func TestHttpLifecycleAttachesQueryParameters(t *testing.T) {
	SetupTestCredentialsFunc()
	defer RestoreCredentialsFunc()

	l := api.NewHttpLifecycle(NewTestConfig())
	req, err := l.Build(&api.RequestSchema{
		Path:      "/foo",
		Operation: api.DownloadOperation,<commit_msg>fix imports<commit_after>package api_test

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

	"github.com/git-lfs/git-lfs/api"
	"github.com/git-lfs/git-lfs/config"
	"github.com/git-lfs/git-lfs/endpoint"
	"github.com/stretchr/testify/assert"
)

func NewTestConfig() *config.Configuration {
	c := config.NewFrom(config.Values{})
	c.SetManualEndpoint(endpoint.Endpoint{Url: "https://example.com"})
	return c
}

func TestHttpLifecycleMakesRequestsAgainstAbsolutePath(t *testing.T) {
	SetupTestCredentialsFunc()
	defer RestoreCredentialsFunc()

	l := api.NewHttpLifecycle(NewTestConfig())
	req, err := l.Build(&api.RequestSchema{
		Path:      "/foo",
		Operation: api.DownloadOperation,
	})

	assert.Nil(t, err)
	assert.Equal(t, "https://example.com/foo", req.URL.String())
}

func TestHttpLifecycleAttachesQueryParameters(t *testing.T) {
	SetupTestCredentialsFunc()
	defer RestoreCredentialsFunc()

	l := api.NewHttpLifecycle(NewTestConfig())
	req, err := l.Build(&api.RequestSchema{
		Path:      "/foo",
		Operation: api.DownloadOperation,
{'fraction_non_alphanumeric': 0.15176413726437893, 'fraction_numerical': 0.0, 'mean_word_length': 5.234939759036145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3277215', 'n_tokens_mistral': 759, 'n_tokens_neox': 748, 'n_words': 109}