
8 changed files with 358 additions and 59 deletions
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
def test_add_order(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 |
||||
assert "Aceton" not in response |
||||
|
||||
response = testapp.get("/orders/add/") |
||||
form = response.forms[1] |
||||
form["cas_description"] = "Aceton" |
||||
form["category"] = "SOLVENT" |
||||
form["catalog_nr"] = "567" |
||||
form["vendor"] = "Carl Roth" |
||||
form["package_size"] = "25 l" |
||||
form["quantity"] = "5" |
||||
form["account"] = "DFG" |
||||
form["comment"] = "Ein Kommentar!" |
||||
form.fields["amount"][0].value = "5.67" |
||||
form.fields["amount"][1].value = "5.67" |
||||
form.fields["currency"][0].value = "USD" |
||||
form.fields["currency"][1].value = "USD" |
||||
form.submit("Place_Order") |
||||
|
||||
response = testapp.get("/orders/") |
||||
assert "My Orders" in response |
||||
assert "Eppis" in response |
||||
assert "Ethanol" in response |
||||
assert "NaCl" in response |
||||
assert "Spritzen" in response |
||||
assert "Aceton" in response |
||||
|
||||
response = testapp.get("/orders/5/view/") |
||||
assert "Aceton" in response |
||||
assert "Solvent" in response |
||||
assert "567" in response |
||||
assert "Carl Roth" in response |
||||
assert "25 l" in response |
||||
assert "DFG" in response |
||||
assert "Ein Kommentar!" in response |
||||
assert "5.67" in response |
||||
assert "28.35" in response |
||||
|
||||
|
||||
def test_view_order(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 |
||||
|
||||
response = testapp.get("/orders/3/view/") |
||||
assert "Eppis" in response |
||||
assert "345" in response |
||||
assert "VWR" in response |
||||
assert "Biolab" in response |
||||
assert "3 St" in response |
||||
assert "34.50" in response |
||||
assert "3" in response |
||||
assert "USD" in response |
||||
assert "103.50" in response |
||||
assert "Toto" in response |
||||
assert "auf der Seite" in response |
||||
assert 'href="http://www.example.com/foo"' in response |
||||
assert ">http://www.example.com/foo</a>" in response |
||||
assert "open" in response |
||||
assert "completed" in response |
||||
assert "TestAdmin" in response |
||||
assert "TestUser" in response |
||||
|
||||
|
||||
def test_edit_order_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 |
||||
|
||||
response = testapp.get("/orders/3/edit/") |
||||
form = response.forms[1] |
||||
form["cas_description"] = "Aceton" |
||||
form["category"] = "SOLVENT" |
||||
form["catalog_nr"] = "567" |
||||
form["vendor"] = "Carl Roth" |
||||
form["package_size"] = "25 l" |
||||
form["quantity"] = "5" |
||||
form["account"] = "DFG" |
||||
form["comment"] = "Ein Kommentar!" |
||||
form.fields["amount"][0].value = "5.67" |
||||
form.fields["amount"][1].value = "5.67" |
||||
form.fields["currency"][0].value = "USD" |
||||
form.fields["currency"][1].value = "USD" |
||||
form.submit("Save_Changes") |
||||
|
||||
response = testapp.get("/orders/") |
||||
assert "My Orders" in response |
||||
assert "Eppis" not in response |
||||
assert "Ethanol" in response |
||||
assert "NaCl" in response |
||||
assert "Spritzen" in response |
||||
assert "Aceton" in response |
||||
|
||||
response = testapp.get("/orders/3/view/") |
||||
assert "Aceton" in response |
||||
assert "Solvent" in response |
||||
assert "567" in response |
||||
assert "Carl Roth" in response |
||||
assert "25 l" in response |
||||
assert "DFG" in response |
||||
assert "Ein Kommentar!" in response |
||||
assert "5.67" in response |
||||
assert "28.35" in response |
||||
|
||||
|
||||
def test_delete_order(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 "/orders/4/edit" in response |
||||
|
||||
response = testapp.get("/orders/4/delete") |
||||
form = response.forms[1] |
||||
form["confirmation"].checked = True |
||||
form.submit("delete") |
||||
|
||||
response = testapp.get("/orders/") |
||||
assert "has been deleted" in response |
||||
assert "My Orders" in response |
||||
assert "Eppis" in response |
||||
assert "Ethanol" in response |
||||
assert "NaCl" in response |
||||
assert "/orders/4/edit" not in response |
@ -0,0 +1,125 @@
@@ -0,0 +1,125 @@
|
||||
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 |
Loading…
Reference in new issue