many pep8 improvements
This commit is contained in:
+13
-12
@@ -13,6 +13,7 @@ else:
|
||||
import unittest
|
||||
from contrib.webclient import WebClient
|
||||
|
||||
|
||||
class TestWeb(unittest.TestCase):
|
||||
def testWebClient(self):
|
||||
client = WebClient('http://127.0.0.1:8000/welcome/default/')
|
||||
@@ -20,13 +21,13 @@ class TestWeb(unittest.TestCase):
|
||||
client.get('index')
|
||||
|
||||
# register
|
||||
data = dict(first_name = 'Homer',
|
||||
last_name = 'Simpson',
|
||||
email = 'homer@web2py.com',
|
||||
password = 'test',
|
||||
password_two = 'test',
|
||||
_formname = 'register')
|
||||
client.post('user/register',data = data)
|
||||
data = dict(first_name='Homer',
|
||||
last_name='Simpson',
|
||||
email='homer@web2py.com',
|
||||
password='test',
|
||||
password_two='test',
|
||||
_formname='register')
|
||||
client.post('user/register', data=data)
|
||||
|
||||
# logout
|
||||
client.get('user/logout')
|
||||
@@ -34,21 +35,22 @@ class TestWeb(unittest.TestCase):
|
||||
# login again
|
||||
data = dict(email='homer@web2py.com',
|
||||
password='test',
|
||||
_formname = 'login')
|
||||
client.post('user/login',data = data)
|
||||
_formname='login')
|
||||
client.post('user/login', data=data)
|
||||
|
||||
# check registration and login were successful
|
||||
client.get('index')
|
||||
self.assertTrue('Welcome Homer' in client.text)
|
||||
|
||||
client = WebClient('http://127.0.0.1:8000/admin/default/')
|
||||
client.post('index',data=dict(password='hello'))
|
||||
client.post('index', data=dict(password='hello'))
|
||||
client.get('site')
|
||||
client.get('design/welcome')
|
||||
|
||||
|
||||
class TestStaticCacheControl(unittest.TestCase):
|
||||
def testWebClient(self):
|
||||
s=WebClient('http://127.0.0.1:8000/welcome/')
|
||||
s = WebClient('http://127.0.0.1:8000/welcome/')
|
||||
s.get('static/js/web2py.js')
|
||||
assert('expires' not in s.headers)
|
||||
assert(not s.headers['cache-control'].startswith('max-age'))
|
||||
@@ -60,4 +62,3 @@ class TestStaticCacheControl(unittest.TestCase):
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user