@ -1,8 +1,12 @@
@@ -1,8 +1,12 @@
import pytest
@pytest . mark . fun
def test_view_order ( testapp , login_as ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
response = testapp . get ( " /orders/3/view/ " )
@ -25,11 +29,12 @@ def test_view_order(testapp, login_as):
@@ -25,11 +29,12 @@ def test_view_order(testapp, login_as):
assert " TestUser " in response
@pytest . mark . fun
def test_add_order_ok ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains (
response ,
@ -79,11 +84,12 @@ def test_add_order_ok(testapp, login_as, contains):
@@ -79,11 +84,12 @@ def test_add_order_ok(testapp, login_as, contains):
assert " 28.35 " in response
@pytest . mark . fun
def test_add_order_validation_error ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains (
response ,
@ -110,11 +116,12 @@ def test_add_order_validation_error(testapp, login_as, contains):
@@ -110,11 +116,12 @@ def test_add_order_validation_error(testapp, login_as, contains):
)
@pytest . mark . fun
def test_add_order_cancel ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains (
response ,
@ -153,11 +160,12 @@ def test_add_order_cancel(testapp, login_as, contains):
@@ -153,11 +160,12 @@ def test_add_order_cancel(testapp, login_as, contains):
)
@pytest . mark . fun
def test_edit_order_ok ( testapp , login_as , contains , parse_latest_mail ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains (
response ,
@ -214,11 +222,12 @@ def test_edit_order_ok(testapp, login_as, contains, parse_latest_mail):
@@ -214,11 +222,12 @@ def test_edit_order_ok(testapp, login_as, contains, parse_latest_mail):
assert " - new status: Hold " in parsed . body
@pytest . mark . fun
def test_edit_order_form_error ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
response = testapp . get ( " /orders/3/edit/ " )
@ -251,11 +260,12 @@ def test_edit_order_form_error(testapp, login_as, contains):
@@ -251,11 +260,12 @@ def test_edit_order_form_error(testapp, login_as, contains):
)
@pytest . mark . fun
def test_edit_order_cancel ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
response = testapp . get ( " /orders/3/edit/ " )
@ -286,11 +296,12 @@ def test_edit_order_cancel(testapp, login_as, contains):
@@ -286,11 +296,12 @@ def test_edit_order_cancel(testapp, login_as, contains):
)
@pytest . mark . fun
def test_edit_order_purchaser_vs_user ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
response = testapp . get ( " /orders/4/edit/ " )
@ -298,7 +309,7 @@ def test_edit_order_purchaser_vs_user(testapp, login_as, contains):
@@ -298,7 +309,7 @@ def test_edit_order_purchaser_vs_user(testapp, login_as, contains):
status = soup . find ( " select " , { " id " : " deformField3 " } )
assert not status . has_attr ( " readonly " )
response = login_as ( " TestUser " , " jon " ) . follow ( status = 200 )
response = login_as ( " TestUser " , " jon " ) . follow ( )
assert " My Orders " in response
response = testapp . get ( " /orders/4/edit/ " )
@ -307,11 +318,12 @@ def test_edit_order_purchaser_vs_user(testapp, login_as, contains):
@@ -307,11 +318,12 @@ def test_edit_order_purchaser_vs_user(testapp, login_as, contains):
assert status . has_attr ( " readonly " )
@pytest . mark . fun
def test_delete_order_ok ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains ( response , Eppis = True , Ethanol = True , NaCl = True )
# don't check for "Spritzen", the term will apear in the flash message
@ -332,11 +344,12 @@ def test_delete_order_ok(testapp, login_as, contains):
@@ -332,11 +344,12 @@ def test_delete_order_ok(testapp, login_as, contains):
assert " /orders/4/edit " not in response
@pytest . mark . fun
def test_delete_order_cancel ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains ( response , Eppis = True , Ethanol = True , NaCl = True )
# don't check for "Spritzen", the term will apear in the flash message
@ -357,11 +370,12 @@ def test_delete_order_cancel(testapp, login_as, contains):
@@ -357,11 +370,12 @@ def test_delete_order_cancel(testapp, login_as, contains):
assert " /orders/4/edit " in response
@pytest . mark . fun
def test_delete_order_no_confirm ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert contains ( response , Eppis = True , Ethanol = True , NaCl = True )
# don't check for "Spritzen", the term will apear in the flash message
@ -382,11 +396,12 @@ def test_delete_order_no_confirm(testapp, login_as, contains):
@@ -382,11 +396,12 @@ def test_delete_order_no_confirm(testapp, login_as, contains):
assert " /orders/4/edit " in response
@pytest . mark . fun
def test_reorder_ok ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert " 1138,50 " not in response
assert " /orders/5/edit " not in response
@ -412,11 +427,12 @@ def test_reorder_ok(testapp, login_as, contains):
@@ -412,11 +427,12 @@ def test_reorder_ok(testapp, login_as, contains):
)
@pytest . mark . fun
def test_reorder_cancel ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert " 1138,50 " not in response
assert " /orders/5/edit " not in response
@ -437,11 +453,12 @@ def test_reorder_cancel(testapp, login_as, contains):
@@ -437,11 +453,12 @@ def test_reorder_cancel(testapp, login_as, contains):
)
@pytest . mark . fun
def test_reorder_form_error ( testapp , login_as , contains ) :
response = testapp . get ( " / " , status = 302 ) . follow ( status = 200 )
response = testapp . get ( " / " , status = 302 ) . follow ( )
assert " Please Log In " in response
response = login_as ( " TestAdmin " , " jane " ) . follow ( status = 200 )
response = login_as ( " TestAdmin " , " jane " ) . follow ( )
assert " My Orders " in response
assert " 1138,50 " not in response
assert " /orders/5/edit " not in response