eBay marketplaces are now polled through eBay's official Buy > Browse API (client-credentials OAuth2) instead of an Apify scraper actor; Apify still handles Yahoo JP and Mercari. Browse API calls are tracked per day in a new ebay_api_usage table and capped (default 5000, configurable) on eBay's Pacific-time reset clock, so polling halts before the limit is hit. Credentials live in config.toml [ebay] and are overridable via /settings, which also surfaces the day's running call count. Also carries the server.secure_cookies config plumbing (field, accessor, example) consumed by the following commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package ebay
|
|
|
|
import "testing"
|
|
|
|
func TestMarketplaceID(t *testing.T) {
|
|
cases := map[string]string{
|
|
"ebay.com": "EBAY_US",
|
|
"ebay.co.uk": "EBAY_GB",
|
|
"ebay.de": "EBAY_DE",
|
|
"ebay.com.au": "EBAY_AU",
|
|
"EBAY.CA": "EBAY_CA",
|
|
"ebay": "EBAY_US",
|
|
"weird-market": "EBAY_US",
|
|
" ebay.it ": "EBAY_IT",
|
|
}
|
|
for in, want := range cases {
|
|
if got := MarketplaceID(in); got != want {
|
|
t.Errorf("MarketplaceID(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestIsEbayMarketplace(t *testing.T) {
|
|
if !IsEbayMarketplace("ebay.co.uk") {
|
|
t.Error("ebay.co.uk should be an eBay marketplace")
|
|
}
|
|
if IsEbayMarketplace("yahoo-auctions-jp") {
|
|
t.Error("yahoo should not be an eBay marketplace")
|
|
}
|
|
}
|
|
|
|
func TestBuyingOptionsFilter(t *testing.T) {
|
|
cases := map[string]string{
|
|
"": "",
|
|
"all": "",
|
|
"bin": "buyingOptions:{FIXED_PRICE}",
|
|
"buy_it_now": "buyingOptions:{FIXED_PRICE}",
|
|
"auction": "buyingOptions:{AUCTION}",
|
|
}
|
|
for in, want := range cases {
|
|
if got := buyingOptionsFilter(in); got != want {
|
|
t.Errorf("buyingOptionsFilter(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|