Written first test
This commit is contained in:
parent
e562c689e4
commit
a34d8b991b
|
@ -9,10 +9,10 @@ cache:
|
||||||
- $HOME/gopath/src/github.com/nitrous-io
|
- $HOME/gopath/src/github.com/nitrous-io
|
||||||
- $HOME/gopath/src/github.com/MichaelOultram/mumbledj/.vendor
|
- $HOME/gopath/src/github.com/MichaelOultram/mumbledj/.vendor
|
||||||
|
|
||||||
before_script:
|
before_install:
|
||||||
- export PATH=$PATH:~/bin/
|
- export PATH=$PATH:~/bin/
|
||||||
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/opus/lib/pkgconfig
|
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/opus/lib/pkgconfig
|
||||||
- bash install-dependencies.sh
|
- bash install-dependencies.sh
|
||||||
|
|
||||||
install:
|
after_success:
|
||||||
- ls -R $HOME/opus
|
- go test
|
49
test.go
Normal file
49
test.go
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func createClient(uname string) *gumble.Client {
|
||||||
|
return gumble.NewClient(&gumble.Config{
|
||||||
|
Username: uname,
|
||||||
|
Password: password,
|
||||||
|
Address: address + ":" + port,
|
||||||
|
Tokens: strings.Split(accesstokens, " ")})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestYoutubeSong(t *testing.T) {
|
||||||
|
dummy1Client := createClient("dummy")
|
||||||
|
dummy1Client.Connect()
|
||||||
|
dummy1 := gumble.Find("dummy")
|
||||||
|
|
||||||
|
// Don't judge, I used the (autogenerated) Top Tracks for United Kingdom playlist
|
||||||
|
songs := map[string]string{
|
||||||
|
"http://www.youtube.com/watch?v=QcIy9NiNbmo": "Taylor Swift - Bad Blood ft. Kendrick Lamar",
|
||||||
|
"https://www.youtube.com/watch?v=vjW8wmF5VWc": "Silentó - Watch Me (Whip/Nae Nae) (Official)",
|
||||||
|
"http://youtu.be/nsDwItoNlLc": "Tinie Tempah ft. Jess Glynne - Not Letting Go (Official Video)",
|
||||||
|
"https://youtu.be/hXTAn4ELEwM": "Years & Years - Shine",
|
||||||
|
"http://youtube.com/watch?v=RgKAFK5djSk": "Wiz Khalifa - See You Again ft. Charlie Puth [Official Video] Furious 7 Soundtrack",
|
||||||
|
"https://youtube.com/watch?v=qWWSM3wCiKY": "Calvin Harris & Disciples - How Deep Is Your Love (Audio)",
|
||||||
|
"http://www.youtube.com/v/yzTuBuRdAyA": "The Weeknd - The Hills",
|
||||||
|
"https://www.youtube.com/v/cNw8A5pwbVI": "Pia Mia - Do It Again ft. Chris Brown, Tyga",
|
||||||
|
}
|
||||||
|
|
||||||
|
for url, title := range songs {
|
||||||
|
err := add(dummy1, url)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(
|
||||||
|
"For", url,
|
||||||
|
"expected", title,
|
||||||
|
"got", err,
|
||||||
|
)
|
||||||
|
} else if dj.queue.CurrentSong().Title() != title {
|
||||||
|
t.Error(
|
||||||
|
"For", url,
|
||||||
|
"expected", title,
|
||||||
|
"got", dj.queue.CurrentSong().Title(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
skip(dummy1, false, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
dummy1Client.Disconnect()
|
||||||
|
}
|
Reference in a new issue