#!/usr/bin/python3 from flask import url_for from .util import live_server_setup, wait_for_all_checks, extract_UUID_from_client instock_props = [ # LD JSON '', '', '' # Microdata '

Example Product

This is a sample product description.

Price: $19.99

' ] out_of_stock_props = [ # out of stock AND contains multiples '' ] def set_original_response(props_markup): test_return_data = f""" Some initial text

Which is across multiple lines


So let's see what happens.
price: $10.99
{props_markup} """ with open("test-datastore/endpoint-content.txt", "w") as f: f.write(test_return_data) return None def test_restock_itemprop_basic(client, live_server): live_server_setup(live_server) test_url = url_for('test_endpoint', _external=True) for p in instock_props: set_original_response(props_markup=p) client.post( url_for("form_quick_watch_add"), data={"url": test_url, "tags": 'restock tests', 'processor': 'restock_diff'}, follow_redirects=True ) wait_for_all_checks(client) res = client.get(url_for("index")) assert b' in-stock' in res.data res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) assert b'Deleted' in res.data for p in out_of_stock_props: set_original_response(props_markup=p) client.post( url_for("form_quick_watch_add"), data={"url": test_url, "tags": '', 'processor': 'restock_diff'}, follow_redirects=True ) wait_for_all_checks(client) res = client.get(url_for("index")) assert b'not-in-stock' in res.data res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) assert b'Deleted' in res.data # @todo check restock and price change conditions