aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-04-14 19:41:30 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-04-14 19:41:30 +0200
commit37e4be24129b6980e3e9fced7345d4a596af3d58 (patch)
tree3443f320e6fd77558786fb022cb78b5babcc1985 /test
parent791cd8213214feb7af77e434ee260e48984086fb (diff)
downloadee-python-37e4be24129b6980e3e9fced7345d4a596af3d58.tar.gz
ee-python-37e4be24129b6980e3e9fced7345d4a596af3d58.tar.bz2
ee-python-37e4be24129b6980e3e9fced7345d4a596af3d58.tar.xz
ee-python-37e4be24129b6980e3e9fced7345d4a596af3d58.zip
digikey:
o More flexibility, making room for the multiple digikey stores. o Removing URLs from core code. new tools: split_parts_by_supplier.
Diffstat (limited to 'test')
-rw-r--r--test/test_digikey.py26
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"