Skip to content

Commit

Permalink
test(genius): exclude from scraping
Browse files Browse the repository at this point in the history
Apparently Genius blocks CI runners (cfr. johnwmillr/LyricsGenius#220) API requests.
  • Loading branch information
streambinder committed Jul 10, 2023
1 parent 7a0979c commit 750db4f
Showing 1 changed file with 35 additions and 37 deletions.
72 changes: 35 additions & 37 deletions lyrics/genius_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import (
"fmt"
"io"
"net/http"
"os"
"reflect"
"strings"
"testing"
"time"

"github.com/PuerkitoBio/goquery"
"github.com/agiledragon/gomonkey/v2"
"github.com/streambinder/spotitube/entity"
"github.com/streambinder/spotitube/util"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -291,38 +289,38 @@ func TestGeniusLyricsNotParseable(t *testing.T) {
assert.EqualError(t, util.ErrOnly(genius{}.search(track)), "ko")
}

func TestScraping(t *testing.T) {
if os.Getenv("TEST_SCRAPING") == "" {
return
}

// testing
lyrics, err := genius{}.search(&entity.Track{
Title: "White Christmas",
Artists: []string{"Bing Crosby"},
})
assert.Nil(t, err)
assert.Equal(t, []byte(`[Verse 1: Bing Crosby]
I'm dreaming of a white Christmas
Just like the ones I used to know
Where the treetops glisten and children listen
To hear sleigh bells in the snow
[Verse 2: Bing Crosby]
I'm dreaming of a white Christmas
With every Christmas card I write
"May your days be merry and bright
And may all your Christmases be white"
[Verse 3: Bing Crosby & Ken Darby Singers]
I'm dreaming of a white Christmas
Just like the ones I used to know
Where the treetops glisten and children listen
To hear sleigh bells in the snow
[Verse 4: Bing Crosby & Ken Darby Singers, Bing Crosby]
I'm dreaming of a white Christmas
With every Christmas card I write
"May your days be merry and bright
And may all your Christmases be white"`), lyrics)
}
// func TestScraping(t *testing.T) {
// if os.Getenv("TEST_SCRAPING") == "" {
// return
// }

// // testing
// lyrics, err := genius{}.search(&entity.Track{
// Title: "White Christmas",
// Artists: []string{"Bing Crosby"},
// })
// assert.Nil(t, err)
// assert.Equal(t, []byte(`[Verse 1: Bing Crosby]
// I'm dreaming of a white Christmas
// Just like the ones I used to know
// Where the treetops glisten and children listen
// To hear sleigh bells in the snow

// [Verse 2: Bing Crosby]
// I'm dreaming of a white Christmas
// With every Christmas card I write
// "May your days be merry and bright
// And may all your Christmases be white"

// [Verse 3: Bing Crosby & Ken Darby Singers]
// I'm dreaming of a white Christmas
// Just like the ones I used to know
// Where the treetops glisten and children listen
// To hear sleigh bells in the snow

// [Verse 4: Bing Crosby & Ken Darby Singers, Bing Crosby]
// I'm dreaming of a white Christmas
// With every Christmas card I write
// "May your days be merry and bright
// And may all your Christmases be white"`), lyrics)
// }

0 comments on commit 750db4f

Please sign in to comment.