diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_digikey.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/test_digikey.py b/test/test_digikey.py index 2e9b1f1..568360e 100644 --- a/test/test_digikey.py +++ b/test/test_digikey.py @@ -12,7 +12,8 @@ static_copies = basedir / "digikey" / "static-copies" # type: Path digikey = dk.Digikey() parser = dk.DigikeyParser(digikey) -client = dk.DigikeyClient(cache_dir=basedir / "digikey" / "static-copies", on_download=print) +client = dk.DigikeyClient("https://www.digikey.com/products/en", cache_dir=basedir / "digikey" / "static-copies", + on_download=print) force_refresh = False # Set to True to always fetch the updated html files @@ -83,3 +84,26 @@ def test_digikey_3(): p = next((p for p in res.products if p.part_number == "1655-1501-1-ND"), None) assert p.mpn == "RS1MTR" assert p.url == "/product-detail/en/smc-diode-solutions/RS1MTR/1655-1501-1-ND/6022946" + + +@pytest.mark.digikey +def test_store(): + store = dk.DigikeyStore.from_store_code("us") + assert store.products_url == "https://www.digikey.com/products/en" + assert store.url == "http://purl.org/ee/supplier/digikey?store=us" + assert store.store == "us" + + store = dk.DigikeyStore.from_url(store.url) + assert store.products_url == "https://www.digikey.com/products/en" + assert store.url == "http://purl.org/ee/supplier/digikey?store=us" + assert store.store == "us" + + store = dk.DigikeyStore.from_store_code("no") + assert store.products_url == "https://www.digikey.no/products/en" + assert store.url == "http://purl.org/ee/supplier/digikey?store=no" + assert store.store == "no" + + store = dk.DigikeyStore.from_url(store.url) + assert store.products_url == "https://www.digikey.no/products/en" + assert store.url == "http://purl.org/ee/supplier/digikey?store=no" + assert store.store == "no" |