Trying to work out why dummy won't connect

This commit is contained in:
MichaelOultram 2015-08-12 20:31:12 +01:00
parent d9527a4093
commit c6c58c4d11
2 changed files with 14 additions and 10 deletions

View file

@ -249,7 +249,7 @@ func main() {
if testcode { if testcode {
Verbose("Testing is enabled") Verbose("Testing is enabled")
Test(password, address, port) Test(password, address, port, accesstokens)
} }
web = NewWebServer(9563) web = NewWebServer(9563)

22
test.go
View file

@ -7,18 +7,20 @@ import (
) )
type TestSettings struct { type TestSettings struct {
password string password string
ip string ip string
port string port string
accesstokens []string
} }
var test TestSettings var test TestSettings
func Test(password, ip, port string) { func Test(password, ip, port, accesstokens string) {
test = TestSettings{ test = TestSettings{
password: password, password: password,
ip: ip, ip: ip,
port: port, port: port,
accesstokens: strings.Split(accesstokens, " "),
} }
test.testYoutubeSong() test.testYoutubeSong()
} }
@ -27,13 +29,15 @@ func (t TestSettings) createClient(uname string) *gumble.Client {
return gumble.NewClient(&gumble.Config{ return gumble.NewClient(&gumble.Config{
Username: uname, Username: uname,
Password: t.password, Password: t.password,
Address: t.ip + ":" + t.port}) Address: t.ip + ":" + t.port,
Tokens: t.accesstokens,
})
} }
func (t TestSettings) testYoutubeSong() { func (t TestSettings) testYoutubeSong() {
dummyClient := t.createClient("dummy") dummyClient := t.createClient("dummy")
dummyClient.Connect() dummyClient.Connect()
time.Sleep(time.Second * 5) // Give dummy time to connect time.Sleep(time.Second * 5) // Give dummy time to connect
dummyUser := dj.client.Users.Find("dummy") // May be nil dummyUser := dj.client.Users.Find("dummy") // May be nil
// Don't judge, I used the (autogenerated) Top Tracks for United Kingdom playlist // Don't judge, I used the (autogenerated) Top Tracks for United Kingdom playlist