from datetime import datetime, timedelta
import time
import hashlib

from pylons import url, config
from {{package}}.model import *
from {{package}}.tests import *

class TestLoginController(TestController):

    def setUp(self):
        TestModel.setUp(self)
    
    
    def tearDown(self):
        TestModel.tearDown(self)
        Session.close()
    
    
    def test_admin_signin(self):
        """Ensure that signin is successful"""
        response = self.app.post(
                        url(controller='login', action='signin'),
                            params={'username':u'admin',
                                    'password':"admin"})
        
        assert response.status_int == 302
        
        assert response.location == 'http://localhost/dashboard/index'
    

    def test_admin_signout(self):
        """Ensure that signout is successful."""
        response = self.app.get(url(controller='login', action='signout'))
        
        assert response.status_int == 302
        
        assert response.location == 'http://localhost/login/index'
    

