def test_order_list(testapp, login_as): response = testapp.get("/", status=302).follow(status=200) assert "Please Log In" in response response = login_as("TestAdmin", "jane").follow(status=200) assert "My Orders" in response assert "Eppis" in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" in response response = testapp.get("/orders?status=completed", status=200) assert "Eppis" in response assert "Ethanol" in response assert "NaCl" not in response assert "Spritzen" not in response response = testapp.get("/orders?user=TestAdmin", status=200) assert "Eppis" not in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" not in response response = testapp.get( "/orders?user=TestAdmin&status=completed", status=200 ) assert "Eppis" not in response assert "Ethanol" in response assert "NaCl" not in response assert "Spritzen" not in response response = testapp.get( "/orders?user=TestAdmin&status=approval", status=200 ) assert "Eppis" not in response assert "Ethanol" not in response assert "NaCl" in response assert "Spritzen" not in response response = testapp.get("/orders?user=-purchaser-", status=200) assert "Eppis" in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" not in response response = testapp.get("/orders?search=vwr", status=200) assert "Eppis" in response assert "Ethanol" in response assert "NaCl" not in response assert "Spritzen" not in response def test_multi_edit_ok(testapp, login_as): response = testapp.get("/", status=302).follow(status=200) assert "Please Log In" in response response = login_as("TestAdmin", "jane").follow(status=200) assert "My Orders" in response form = response.forms[1] form.action = "/orders/batch-edit/" select_checkboxes = form.fields["selection"] select_checkboxes[0].checked = True select_checkboxes[1].checked = True response = form.submit() assert "Eppis" not in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" not in response form = response.forms[1] form["status-1"].value = "HOLD" form["status-2"].value = "HOLD" form.submit("change") response = testapp.get("/orders?status=completed", status=200) assert "orders have been updated." in response assert "Eppis" in response assert "Ethanol" not in response assert "NaCl" not in response assert "Spritzen" not in response response = testapp.get("/orders?status=open", status=200) assert "Eppis" not in response assert "Ethanol" not in response assert "NaCl" not in response assert "Spritzen" in response response = testapp.get("/orders?status=hold", status=200) assert "Eppis" not in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" not in response def test_multi_delete_ok(testapp, login_as): response = testapp.get("/", status=302).follow(status=200) assert "Please Log In" in response response = login_as("TestAdmin", "jane").follow(status=200) assert "My Orders" in response form = response.forms[1] form.action = "/orders/batch-delete/" select_checkboxes = form.fields["selection"] select_checkboxes[0].checked = True select_checkboxes[3].checked = True response = form.submit() assert "Eppis" not in response assert "Ethanol" not in response assert "NaCl" not in response assert "Spritzen" in response form = response.forms[1] form["confirmation"].checked = True form.submit("delete") response = testapp.get("/orders", status=200) assert "orders have been deleted." in response assert "Eppis" in response assert "Ethanol" in response assert "NaCl" in response assert "Spritzen" not in response