# Path: studio/tests/lib/helpers.py
# def log_in(app, login, password):
#     response = app.get(url('/login'),
#             params={
#                 'login': login,
#                 'password': password,
#                 })
#     assert response.status.startswith('302 ')
# 
# def log_out(app):
#     response = app.get(url('/logout'))
#     assert response.status.startswith('302 ')
# 
# Path: studio/lib/provisionning.py
# def create_layertemplate(lt_name, lt_comment, json, user_id=2):
#     lt = LayerTemplate(lt_name, lt_comment, json, user_id)
#     meta.Session.add(lt)
#     meta.Session.commit()
#     return lt


import simplejson 
from studio.tests import *
from studio.model import *
from studio.tests.lib.helpers import log_in, log_out
from studio.lib.provisionning import create_layertemplate
#
# This file is part of Studio
#
# Studio is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Studio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Studio.  If not, see <http://www.gnu.org/licenses/>.
#



class TestLayertemplatesController(TestController):

    def setUp(self):
        meta.Session.query(LayerTemplate).delete()
        log_in(self.app, 'enduser', 'password')

    def tearDown(self):
        meta.Session.rollback()

    def _insert_layertemplates(self):
        lt1 = create_layertemplate('layertemplate1', 'comment for layertemplate1', [{'a': 12, 'b': 34}, {'c': 56}])

# Path: studio/tests/lib/helpers.py
# def log_in(app, login, password):
#     response = app.get(url('/login'),
#             params={
#                 'login': login,
#                 'password': password,
#                 })
#     assert response.status.startswith('302 ')
# 
# def log_out(app):
#     response = app.get(url('/logout'))
#     assert response.status.startswith('302 ')
# 
# Path: studio/lib/provisionning.py
# def create_layertemplate(lt_name, lt_comment, json, user_id=2):
#     lt = LayerTemplate(lt_name, lt_comment, json, user_id)
#     meta.Session.add(lt)
#     meta.Session.commit()
#     return lt


# Path: studio/tests/functional/test_layertemplates.py
import simplejson 
from studio.tests import *
from studio.model import *
from studio.tests.lib.helpers import log_in, log_out
from studio.lib.provisionning import create_layertemplate

#
# This file is part of Studio
#
# Studio is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Studio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Studio.  If not, see <http://www.gnu.org/licenses/>.
#



class TestLayertemplatesController(TestController):

    def setUp(self):
        meta.Session.query(LayerTemplate).delete()
        log_in(self.app, 'enduser', 'password')

    def tearDown(self):
        meta.Session.rollback()

    def _insert_layertemplates(self):
        lt1 = create_layertemplate('layertemplate1', 'comment for layertemplate1', [{'a': 12, 'b': 34}, {'c': 56}])

        lt2 = create_layertemplate('layertemplate2', 'comment for layertemplate2', {'test': [{'d': 7, 'e': 8}, {'f': 9}]})