# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Views - Index - Tests
"""

# Imports #####################################################################

from instance.tests.base import WithUserTestCase


# Tests #######################################################################

class 
(WithUserTestCase):
    """
    Test cases for views
    """
    def test_index_unauthenticated(self):
        """
        Index view - Unauthenticated users go to login page
        """
        response = self.client.get('/')
        self.assertRedirects(response, 'http://testserver/admin/login/?next=/')

    def test_index_authenticated(self):
        """
        Index view - Authenticated
        """
        self.client.login(username='user1', password='pass')
        response = self.client.get('/')
        self.assertContains(response, 'ng-app="InstanceApp"')

IndexViewsTestCase