feat: update amazon driver
This commit is contained in:
13
app/.rtk/filters.toml
Normal file
13
app/.rtk/filters.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Project-local RTK filters — commit this file with your repo.
|
||||||
|
# Filters here override user-global and built-in filters.
|
||||||
|
# Docs: https://github.com/rtk-ai/rtk#custom-filters
|
||||||
|
schema_version = 1
|
||||||
|
|
||||||
|
# Example: suppress build noise from a custom tool
|
||||||
|
# [filters.my-tool]
|
||||||
|
# description = "Compact my-tool output"
|
||||||
|
# match_command = "^my-tool\\s+build"
|
||||||
|
# strip_ansi = true
|
||||||
|
# strip_lines_matching = ["^\\s*$", "^Downloading", "^Installing"]
|
||||||
|
# max_lines = 30
|
||||||
|
# on_empty = "my-tool: ok"
|
||||||
File diff suppressed because it is too large
Load Diff
11
app/amazon/product.py
Normal file
11
app/amazon/product.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from .base import AmamzonBase, UserInfo
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
user_info: UserInfo = {"company": "rongchuang123", "username": "自动化_Robot", "password": "#20zsg25"}
|
||||||
|
driver = AmamzonBase(user_info)
|
||||||
|
|
||||||
|
shop_name = "郭亚芳"
|
||||||
|
country = "德国"
|
||||||
|
|
||||||
|
driver.open_shop(shop_name)
|
||||||
|
driver.SwitchingCountries(country)
|
||||||
@@ -91,6 +91,9 @@ dependencies = [
|
|||||||
[tool.uv]
|
[tool.uv]
|
||||||
package = false
|
package = false
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
pythonpath = ["."]
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"pytest>=8.4.2",
|
"pytest>=8.4.2",
|
||||||
|
|||||||
@@ -154,6 +154,33 @@ def test_get_browser_list_status_handling(monkeypatch, payload, expected):
|
|||||||
assert base.ZiniaoDriver({}).get_browser_list() == expected
|
assert base.ZiniaoDriver({}).get_browser_list() == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_core_retries_none_then_returns_on_success(monkeypatch):
|
||||||
|
calls = []
|
||||||
|
responses = [FakeResponse(None), FakeResponse({"statusCode": 0})]
|
||||||
|
|
||||||
|
def fake_post(url, data, timeout):
|
||||||
|
calls.append(json.loads(data.decode("utf-8")))
|
||||||
|
return responses.pop(0)
|
||||||
|
|
||||||
|
monkeypatch.setattr(base.requests, "post", fake_post)
|
||||||
|
monkeypatch.setattr(base.time, "sleep", lambda seconds: None)
|
||||||
|
|
||||||
|
base.ZiniaoDriver({}).update_core()
|
||||||
|
|
||||||
|
assert [payload["action"] for payload in calls] == ["updateCore", "updateCore"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_wait_until_client_ready_polls_until_available(monkeypatch):
|
||||||
|
readiness = [False, False, True]
|
||||||
|
sleeps = []
|
||||||
|
driver = base.ZiniaoDriver({})
|
||||||
|
monkeypatch.setattr(driver, "_is_client_ready", lambda: readiness.pop(0))
|
||||||
|
monkeypatch.setattr(base.time, "sleep", lambda seconds: sleeps.append(seconds))
|
||||||
|
|
||||||
|
assert driver._wait_until_client_ready(timeout=10) is True
|
||||||
|
assert sleeps == [base.CLIENT_READY_INTERVAL, base.CLIENT_READY_INTERVAL]
|
||||||
|
|
||||||
|
|
||||||
def test_close_store_success_uses_current_store(monkeypatch):
|
def test_close_store_success_uses_current_store(monkeypatch):
|
||||||
payloads = []
|
payloads = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user