Skip to content

Commit

Permalink
fix test response
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny-Dasilva committed Oct 23, 2023
1 parent 8634969 commit 7cf29ae
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions cycletls/tests/integration/latest_fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ type PeetResp struct {
Ja3Hash string `json:"ja3_hash"`
AkamaiFingerprint string `json:"akamai"`
AkamaiHash string `json:"akamai_hash"`
PeetPrint string `json:"peetprint"`
}

var PeetRequests = []AkamaiOptions{
{"aa7744226c695c0b2e440419848cf700", // Firefox 101
"771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-156-157-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
"1:65536,4:131072,5:16384|12517377|3:0:0:201,5:0:0:101,7:0:0:1,9:0:7:1,11:0:3:1,13:0:0:241|m,a,s,p",
"1:65536,4:131072,5:16384|12517377|3:0:0:201,5:0:0:101,7:0:0:1,9:0:7:1,11:0:3:1,13:0:0:241|m,p,a,s",
"55cf0afe9d2dd7ec0cb7f0402594f663",
200},
{"e1d8b04eeb8ef3954ec4f49267a783ef", // Chrome 104
Expand All @@ -56,32 +57,30 @@ func TestLatestVersions(t *testing.T) {
if err != nil {
t.Fatal("Unmarshal Error")
}
if response.Status != 502 {
if response.Status != options.HTTPResponse {
t.Fatal("Expected Result Not given", response.Status, response.Body, options.HTTPResponse, options.Ja3)
} else {
log.Println("ja3er: ", response.Status)
}
jsonResp := new(PeetResp)

err = json.Unmarshal([]byte(response.Body), &jsonResp)
if err != nil {
t.Fatal("Unmarshal Error")
}
if response.Status != options.HTTPResponse {
t.Fatal("Expected Result Not given", response.Status, response.Body, options.HTTPResponse, options.Ja3)
} else {
log.Println("ja3er: ", response.Status)
}
jsonResp := new(PeetResp)

if jsonResp.Ja3Hash != options.Ja3Hash {
t.Fatal("Expected:", options.Ja3Hash, "Got:", jsonResp.Ja3Hash, "for Ja3Hash")
}
if jsonResp.Ja3 != options.Ja3 {
t.Fatal("Expected:", options.Ja3, "Got:", jsonResp.Ja3, "for Ja3")
}
if jsonResp.AkamaiFingerprint != options.AkamaiFingerprint {
t.Fatal("Expected:", options.AkamaiFingerprint, "Got:", jsonResp.AkamaiFingerprint, "for AkamaiFingerprint", options.UserAgent)
}
if jsonResp.AkamaiHash != options.AkamaiHash {
t.Fatal("Expected:", options.AkamaiHash, "Got:", jsonResp.AkamaiHash, "for AkamaiHash", options.UserAgent)
}
err = json.Unmarshal([]byte(response.Body), &jsonResp)
if err != nil {
t.Fatal("Unmarshal Error")
}

if jsonResp.Ja3Hash != options.Ja3Hash {
t.Fatal("Expected:", options.Ja3Hash, "Got:", jsonResp.Ja3Hash, "for Ja3Hash")
}
if jsonResp.Ja3 != options.Ja3 {
t.Fatal("Expected:", options.Ja3, "Got:", jsonResp.Ja3, "for Ja3")
}
if jsonResp.AkamaiFingerprint != options.AkamaiFingerprint {
t.Fatal("Expected:", options.AkamaiFingerprint, "Got:", jsonResp.AkamaiFingerprint, "for AkamaiFingerprint", options.UserAgent)
}
if jsonResp.AkamaiHash != options.AkamaiHash {
t.Fatal("Expected:", options.AkamaiHash, "Got:", jsonResp.AkamaiHash, "for AkamaiHash", options.UserAgent)
}

}
}

0 comments on commit 7cf29ae

Please sign in to comment.