2016-01-11 16:03:41 +00:00
|
|
|
from tests.app.main import create_test_user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_return_list_of_all_templates(notifications_admin, notifications_admin_db, notify_db_session):
|
|
|
|
|
with notifications_admin.test_request_context():
|
|
|
|
|
with notifications_admin.test_client() as client:
|
|
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
|
|
|
|
response = client.get('/templates')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
2016-01-11 16:03:41 +00:00
|
|
|
def test_should_show_page_for_one_templates(notifications_admin, notifications_admin_db, notify_db_session):
|
|
|
|
|
with notifications_admin.test_request_context():
|
|
|
|
|
with notifications_admin.test_client() as client:
|
|
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
|
|
|
|
response = client.get('/templates/template')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
2016-01-11 16:03:41 +00:00
|
|
|
def test_should_redirect_when_saving_a_template(notifications_admin, notifications_admin_db, notify_db_session):
|
|
|
|
|
with notifications_admin.test_request_context():
|
|
|
|
|
with notifications_admin.test_client() as client:
|
|
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
|
|
|
|
response = client.post('/templates/template')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 302
|
|
|
|
|
assert response.location == 'http://localhost/templates'
|