<commit_before>package api_test

import (
	"net/http"
	"net/http/httptest"
	"strings"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/ello/ello-go/streams/api"
	"github.com/ello/ello-go/streams/model"
	"github.com/julienschmidt/httprouter"
	"github.com/m4rw3r/uuid"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

var StreamID uuid.UUID

type mockStreamService struct {
	internal       []model.StreamItem
	lastItemsOnAdd []model.StreamItem
	lastLimit      int
	lastFromSlug   string
}

func (s mockStreamService) Add(items []model.StreamItem) error {
	s.lastItemsOnAdd = items
	s.internal = append(s.internal, items...)
	return nil
}

func (s mockStreamService) Load(query model.StreamQuery, limit int, fromSlug string) ([]model.StreamItem, error) {
	s.lastLimit = limit
	s.lastFromSlug = fromSlug
	return s.internal, nil
}

var (
	router        *httprouter.Router
	response      *httptest.ResponseRecorder
	streamService mockStreamService
)

func Request(method string, route string, body string) {
	r, err := http.NewRequest(method, route, strings.NewReader(body))
	response = httptest.NewRecorder()

	log.WithFields(log.Fields{
		"url":     r.URL,
		"method":  r.Method,
		"headers": r.Header,
		"body":    body,
		"errors":  err,
	}).Debug("About to issue request")

	router.ServeHTTP(response, r)
}
<commit_msg>Fixed tests<commit_after>package api_test

import (
	"net/http"
	"net/http/httptest"
	"strings"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/ello/ello-go/streams/api"
	"github.com/ello/ello-go/streams/model"
	"github.com/julienschmidt/httprouter"
	"github.com/m4rw3r/uuid"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

var StreamID uuid.UUID

type mockStreamService struct {
	internal       []model.StreamItem
	lastItemsOnAdd []model.StreamItem
	lastLimit      int
	lastFromSlug   string
}

func (s mockStreamService) Add(items []model.StreamItem) error {
	s.lastItemsOnAdd = items
	s.internal = append(s.internal, items...)
	return nil
}

func (s mockStreamService) Load(query model.StreamQuery, limit int, fromSlug string) (*model.StreamQueryResponse, error) {
	s.lastLimit = limit
	s.lastFromSlug = fromSlug
	return &model.StreamQueryResponse{Items: s.internal}, nil
}

var (
	router        *httprouter.Router
	response      *httptest.ResponseRecorder
	streamService mockStreamService
)

func Request(method string, route string, body string) {
	r, err := http.NewRequest(method, route, strings.NewReader(body))
	response = httptest.NewRecorder()

	log.WithFields(log.Fields{
		"url":     r.URL,
		"method":  r.Method,
		"headers": r.Header,
		"body":    body,
		"errors":  err,
	}).Debug("About to issue request")

	router.ServeHTTP(response, r)
}

{'fraction_non_alphanumeric': 0.13016453382084095, 'fraction_numerical': 0.0014625228519195613, 'mean_word_length': 4.162264150943396, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7573485', 'n_tokens_mistral': 1013, 'n_tokens_neox': 1002, 'n_words': 200}