<commit_before>package wundergo_integration_test

import (
	"os"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/robdimsdale/wundergo"

	"testing"
	"time"
)

func TestMain(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Wundergo Integration Test Suite")
}

var (
	client wundergo.Client
)

func listContains(lists *[]wundergo.List, list *wundergo.List) bool {
	if lists == nil || list == nil {
		return false
	}

	for _, l := range *lists {
		if l.ID == list.ID {
			return true
		}
	}
	return false
}

func taskContains(tasks *[]wundergo.Task, task *wundergo.Task) bool {
	if tasks == nil || task == nil {
		return false
	}
	for _, t := range *tasks {
		if t.ID == task.ID {
			return true
		}
	}
	return false
}

func positionsContainValue(position *[]wundergo.Position, id uint) bool {
	if position == nil {
		return false
	}

	for _, p := range *position {
		if positionContainsValue(&p, id) {
			return true
		}
	}
	return false
}

func positionContainsValue(position *wundergo.Position, id uint) bool {
	if position == nil {
		return false
	}

	for _, v := range position.Values {
		if v == id {
			return true
		}
	}
	return false
}

func taskCommentsContain(taskComments *[]wundergo.TaskComment, taskComment *wundergo.TaskComment) bool {
	if taskComments == nil || taskComment == nil {
		return false
	}
	for _, t := range *taskComments {
		if t.ID == taskComment.ID {
			return true
		}
	}
	return false
}

var _ = BeforeSuite(func() {

	SetDefaultEventuallyTimeout(5 * time.Second)

	By("Logging in")

	accessToken := os.Getenv("WL_ACCESS_TOKEN")
	clientID := os.Getenv("WL_CLIENT_ID")

	if accessToken == "" {
		Fail("Error - WL_ACCESS_TOKEN must be provided")
	}

	if clientID == "" {
		Fail("Error - WL_CLIENT_ID must be provided")
	}

	client = wundergo.NewOauthClient(accessToken, clientID)
})<commit_msg>Integration tests fail more gracefully if credentials are invalid<commit_after>package wundergo_integration_test

import (
	"os"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/robdimsdale/wundergo"

	"testing"
	"time"
)

func TestMain(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Wundergo Integration Test Suite")
}

var (
	client wundergo.Client
)

func listContains(lists *[]wundergo.List, list *wundergo.List) bool {
	if lists == nil || list == nil {
		return false
	}

	for _, l := range *lists {
		if l.ID == list.ID {
			return true
		}
	}
	return false
}

func taskContains(tasks *[]wundergo.Task, task *wundergo.Task) bool {
	if tasks == nil || task == nil {
		return false
	}
	for _, t := range *tasks {
		if t.ID == task.ID {
			return true
		}
	}
	return false
}

func positionsContainValue(position *[]wundergo.Position, id uint) bool {
	if position == nil {
		return false
	}

	for _, p := range *position {
		if positionContainsValue(&p, id) {
			return true
		}
	}
	return false
}

func positionContainsValue(position *wundergo.Position, id uint) bool {
	if position == nil {
		return false
	}

	for _, v := range position.Values {
		if v == id {
			return true
		}
	}
	return false
}

func taskCommentsContain(taskComments *[]wundergo.TaskComment, taskComment *wundergo.TaskComment) bool {
	if taskComments == nil || taskComment == nil {
		return false
	}
	for _, t := range *taskComments {
		if t.ID == taskComment.ID {
			return true
		}
	}
	return false
}

var _ = BeforeSuite(func() {
	SetDefaultEventuallyTimeout(5 * time.Second)

	By("Logging in")

	accessToken := os.Getenv("WL_ACCESS_TOKEN")
	clientID := os.Getenv("WL_CLIENT_ID")

	if accessToken == "" {
		Fail("Error - WL_ACCESS_TOKEN must be provided")
	}

	if clientID == "" {
		Fail("Error - WL_CLIENT_ID must be provided")
	}

	client = wundergo.NewOauthClient(accessToken, clientID)
	_, err := client.Lists()
	Expect(err).To(BeNil())
})
{'fraction_non_alphanumeric': 0.12907465825446898, 'fraction_numerical': 0.0005257623554153522, 'mean_word_length': 3.657282741738066, 'pattern_counts': {'":': 0, '<': 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': '5039345', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1366, 'n_words': 339}