Skip to content

Commit

Permalink
Merge branch 'release/42.4.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Sep 24, 2020
2 parents 384f62c + 3dda37e commit f9581d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extracts_v71.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func extractFacilitiesFromDocV71(doc *goquery.Document) (Facilities, error) {
}

func extractCancelFleetTokenFromDocV71(doc *goquery.Document, fleetID FleetID) (string, error) {
href := doc.Find("#fleet"+string(fleetID)+" a.icon_link").AttrOr("href", "")
href := doc.Find("div#fleet"+strconv.FormatInt(int64(fleetID), 10)+" a.icon_link").AttrOr("href", "")
m := regexp.MustCompile(`token=([^"]+)`).FindStringSubmatch(href)
if len(m) != 2 {
return "", errors.New("cancel fleet token not found")
Expand Down
6 changes: 6 additions & 0 deletions ogame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func TestWrapper(t *testing.T) {
assert.NotNil(t, bot)
}

func TestExtractCancelFleetTokenFromDocV71(t *testing.T) {
pageHTMLBytes, _ := ioutil.ReadFile("samples/v7.5.0/en/cancel_fleet.html")
token, _ := NewExtractorV71().ExtractCancelFleetToken(pageHTMLBytes, FleetID(9078407))
assert.Equal(t, "db3317fbe004641f7483e8074e34cda1", token)
}

func TestParseInt2(t *testing.T) {
pageHTMLBytes, _ := ioutil.ReadFile("samples/deathstar_price.html")
doc, _ := goquery.NewDocumentFromReader(bytes.NewReader(pageHTMLBytes))
Expand Down

0 comments on commit f9581d1

Please sign in to comment.