Allow setting price-type to NOT_APPLICABLE. Addresses #52

This commit is contained in:
sebthom
2022-03-31 23:26:57 +02:00
parent b87b304639
commit 3964a3a1d3
4 changed files with 11 additions and 8 deletions

View File

@@ -240,8 +240,9 @@ class KleinanzeigenBot(SeleniumMixin):
assert_one_of("type", ("OFFER", "WANTED"))
assert_min_len("title", 10)
assert_has_value("description")
assert_has_value("price")
assert_one_of("price_type", ("FIXED", "NEGOTIABLE", "GIVE_AWAY"))
assert_one_of("price_type", ("FIXED", "NEGOTIABLE", "GIVE_AWAY", "NOT_APPLICABLE"))
if ad_cfg["price_type"] != "NOT_APPLICABLE":
assert_has_value("price")
assert_one_of("shipping_type", ("PICKUP", "SHIPPING", "NOT_APPLICABLE"))
assert_has_value("contact.name")
assert_has_value("republication_interval")
@@ -415,9 +416,11 @@ class KleinanzeigenBot(SeleniumMixin):
#############################
# set price
#############################
self.web_select(By.XPATH, "//select[@id='priceType']", ad_cfg["price_type"])
if ad_cfg["price_type"] != "GIVE_AWAY":
self.web_input(By.ID, "pstad-price", ad_cfg["price"])
price_type = ad_cfg["price_type"]
if price_type != "NOT_APPLICABLE":
self.web_select(By.XPATH, "//select[@id='priceType']", price_type)
if price_type != "GIVE_AWAY":
self.web_input(By.ID, "pstad-price", ad_cfg["price"])
#############################
# set description