<commit_before>package api

import (
	"fmt"
	"koding/db/mongodb/modelhelper"
	"net"
	"socialapi/config"
	"socialapi/workers/common/mux"
	"socialapi/workers/payment"
	"strconv"
	"testing"

	"github.com/koding/runner"
)

func withTestServer(t *testing.T, f func(url string)) {
	const workerName = "paymentwebhook"

	r := runner.New(workerName)
	if err := r.Init(); err != nil {
		t.Fatal(err.Error())
	}

	c := config.MustRead(r.Conf.Path)
	payment.Initialize(c)
	// init mongo connection
	modelhelper.Initialize(c.Mongo)
	defer modelhelper.Close()

	port := getPort()
	mc := mux.NewConfig(workerName, "localhost", port)
	mc.Debug = r.Conf.Debug
	m := mux.New(mc, r.Log, r.Metrics)<commit_msg>go/payment: if our tests iare in debug mode run stripe with verbose mode<commit_after>package api

import (
	"fmt"
	"koding/db/mongodb/modelhelper"
	"net"
	"socialapi/config"
	"socialapi/workers/common/mux"
	"socialapi/workers/payment"
	"strconv"
	"testing"

	"github.com/koding/runner"
	"github.com/stripe/stripe-go"
)

func withTestServer(t *testing.T, f func(url string)) {
	const workerName = "paymentwebhook"

	r := runner.New(workerName)
	if err := r.Init(); err != nil {
		t.Fatal(err.Error())
	}

	c := config.MustRead(r.Conf.Path)
	// init mongo connection
	modelhelper.Initialize(c.Mongo)
	defer modelhelper.Close()

	payment.Initialize(c)

	port := getPort()
	mc := mux.NewConfig(workerName, "localhost", port)
	mc.Debug = r.Conf.Debug
	if r.Conf.Debug {
		stripe.LogLevel = 3
	}
	m := mux.New(mc, r.Log, r.Metrics)
{'fraction_non_alphanumeric': 0.15688859591298615, 'fraction_numerical': 0.0006591957811470006, 'mean_word_length': 4.252595155709343, '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': '4377487', 'n_tokens_mistral': 604, 'n_tokens_neox': 588, 'n_words': 116}