def test_invoice_dont_show_duplicate_button_classcards(client, web2py): """ Does the Button not show when it is a classcard? """ url = '/default/user/login' client.get(url) assert client.status == 200 populate_customers_with_classcards(web2py, 3, invoices=True) url = '/invoices/edit?iID=1' client.get(url) assert client.status == 200 assert 'Duplicate' not in client.text
def test_customers_inactive_dont_list_with_classcard(client, web2py): """ Customers with a classcard after given date """ from populate_os_tables import populate_customers_with_classcards url = '/reports/customers_inactive' client.get(url) assert client.status == 200 populate_customers_with_classcards(web2py, created_on=datetime.date(2014, 1, 1)) data = {'date': datetime.date(2014, 1, 1)} client.post(url, data=data) assert client.status == 200 assert web2py.db.auth_user(1001).first_name not in client.text
def test_classcards(client, web2py): """ Is the list of class cards showing? """ setup_profile_tests(web2py) populate_customers_with_classcards(web2py) ccd = web2py.db.customers_classcards(1) ccd.auth_customer_id = 300 ccd.update_record() web2py.db.commit() url = '/profile/classcards' client.get(url) assert client.status == 200 scd = web2py.db.school_classcards(1) scd_name = scd.Name.split(' ')[0] assert scd_name in client.text assert '2014-01-01' in client.text
def test_customer_classcard_delete(client, web2py): """ Is the delete permission for a customer classcard working? """ setup_permission_tests(web2py) populate_customers_with_classcards(web2py, 1) web2py.auth.add_permission(200, 'read', 'customers_classcards', 0) web2py.db.commit() url = '/customers/classcards?cuID=1001' client.get(url) assert client.status == 200 assert not 'fa-times' in client.text # grant permission and check again web2py.auth.add_permission(200, 'delete', 'customers_classcards', 0) web2py.db.commit() client.get(url) assert client.status == 200 assert 'fa-times' in client.text