<commit_before>package worker

import (
	"fmt"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strings"
	"testing"
	"time"

	gocontext "context"

	"github.com/stretchr/testify/assert"
)

func TestHTTPJobQueue(t *testing.T) {
	hjq, err := NewHTTPJobQueue(nil, "test", "fake", "fake", nil)
	assert.Nil(t, err)
	assert.NotNil(t, hjq)
}

func TestHTTPJobQueue_Jobs(t *testing.T) {
	mux := http.NewServeMux()
	mux.HandleFunc(`/jobs`, func(w http.ResponseWriter, req *http.Request) {
		fmt.Fprintf(w, `{"jobs":["100001"]}`)
	})
	mux.HandleFunc(`/jobs/100001`, func(w http.ResponseWriter, req *http.Request) {<commit_msg>Adjust http job queue test per changed job-board API<commit_after>package worker

import (
	"fmt"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strings"
	"testing"
	"time"

	gocontext "context"

	"github.com/stretchr/testify/assert"
)

func TestHTTPJobQueue(t *testing.T) {
	hjq, err := NewHTTPJobQueue(nil, "test", "fake", "fake", nil)
	assert.Nil(t, err)
	assert.NotNil(t, hjq)
}

func TestHTTPJobQueue_Jobs(t *testing.T) {
	mux := http.NewServeMux()
	mux.HandleFunc(`/jobs/pop`, func(w http.ResponseWriter, req *http.Request) {
		w.WriteHeader(http.StatusOK)
		fmt.Fprintf(w, `{"job_id":"100001"}`)
	})
	mux.HandleFunc(`/jobs/100001/claim`, func(w http.ResponseWriter, req *http.Request) {
		w.WriteHeader(http.StatusOK)
	})
	mux.HandleFunc(`/jobs/100001`, func(w http.ResponseWriter, req *http.Request) {
{'fraction_non_alphanumeric': 0.17816901408450705, 'fraction_numerical': 0.02112676056338028, 'mean_word_length': 5.072649572649572, 'pattern_counts': {'":': 2, '<': 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': '5487028', 'n_tokens_mistral': 615, 'n_tokens_neox': 576, 'n_words': 103}