2016-01-15 17:46:09 +00:00
|
|
|
from tests import create_test_user
|
2016-01-11 16:03:41 +00:00
|
|
|
|
|
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_return_list_of_all_templates(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-11 16:03:41 +00:00
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
2016-01-13 13:14:23 +00:00
|
|
|
response = client.get('/services/123/templates')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_show_page_for_one_templates(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-11 16:03:41 +00:00
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
2016-01-13 13:14:23 +00:00
|
|
|
response = client.get('/services/123/templates/template')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
2016-01-15 15:15:35 +00:00
|
|
|
def test_should_redirect_when_saving_a_template(app_, db_, db_session):
|
|
|
|
|
with app_.test_request_context():
|
|
|
|
|
with app_.test_client() as client:
|
2016-01-11 16:03:41 +00:00
|
|
|
user = create_test_user('active')
|
|
|
|
|
client.login(user)
|
2016-01-13 13:14:23 +00:00
|
|
|
response = client.post('/services/123/templates/template')
|
2015-12-20 00:00:01 +00:00
|
|
|
|
|
|
|
|
assert response.status_code == 302
|
2016-01-13 13:14:23 +00:00
|
|
|
assert response.location == 'http://localhost/services/123/templates'
|