Mercurial > hg > ltpdarepo
changeset 256:739af4852be1
Fix tests.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Fri, 04 Jan 2013 18:47:43 +0100 |
parents | 110c94509ebf |
children | 5e11cd66721d |
files | src/ltpdarepo/tests/manage-databases.txt src/ltpdarepo/tests/manage-queries.txt src/ltpdarepo/tests/manage-users.txt src/ltpdarepo/tests/test_objs.py src/ltpdarepo/tests/test_users.py |
diffstat | 5 files changed, 26 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/tests/manage-databases.txt Fri Jan 04 18:45:38 2013 +0100 +++ b/src/ltpdarepo/tests/manage-databases.txt Fri Jan 04 18:47:43 2013 +0100 @@ -1,5 +1,6 @@ Test setup:: + >>> from urllib import unquote >>> from ltpdarepo.tests.utils import Browser >>> USERNAME, PASSWORD = 'u1', 'u1' >>> browser = Browser() @@ -25,7 +26,7 @@ Create a new database:: >>> browser.getLink('Create database').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/databases/+' >>> browser.getControl(name='id').value = 'database1' @@ -111,7 +112,7 @@ >>> browser.getLink('Create database').click() >>> browser.getControl(name='id').value = '#' >>> browser.getControl(name='submit').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/databases/+' >>> browser.contents '...<span class="error">Invalid ID.</span>...' @@ -122,7 +123,7 @@ >>> browser.getLink('Create database').click() >>> browser.getControl(name='id').value = 'database1' >>> browser.getControl(name='submit').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/databases/+' >>> browser.contents '...<span class="error">MySQL already contains a datbase with this ID.</span>...' @@ -131,7 +132,7 @@ >>> browser.getControl(name='id').value = 'mysql' >>> browser.getControl(name='submit').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/databases/+' >>> browser.contents '...<span class="error">MySQL already contains a datbase with this ID.</span>...'
--- a/src/ltpdarepo/tests/manage-queries.txt Fri Jan 04 18:45:38 2013 +0100 +++ b/src/ltpdarepo/tests/manage-queries.txt Fri Jan 04 18:47:43 2013 +0100 @@ -1,6 +1,6 @@ Test setup:: - >>> from urllib import urlencode + >>> from urllib import urlencode, unquote >>> from ltpdarepo.tests.utils import Browser >>> USERNAME, PASSWORD = 'u1', 'u1' >>> browser = Browser() @@ -20,7 +20,7 @@ Post to the named query creation form:: >>> browser.post('/manage/queries/+', data) - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/queries/+' The form contains the proper query representation in JSON format:: @@ -141,7 +141,7 @@ Post to the named query creation form:: >>> browser.post('/manage/queries/+', data) - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/queries/+' Save query setting title and the databases where it operates::
--- a/src/ltpdarepo/tests/manage-users.txt Fri Jan 04 18:45:38 2013 +0100 +++ b/src/ltpdarepo/tests/manage-users.txt Fri Jan 04 18:47:43 2013 +0100 @@ -1,5 +1,6 @@ Test setup:: + >>> from urllib import unquote >>> from ltpdarepo.tests.utils import Browser >>> USERNAME, PASSWORD = 'u1', 'u1' >>> browser = Browser() @@ -32,7 +33,7 @@ Create a new user:: >>> browser.getLink('Create new user').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/users/+' >>> browser.getControl(name='username').value = 'user1' @@ -249,7 +250,7 @@ >>> browser.getControl(name='username').value = 'u1' >>> browser.getControl(name='email').value = 'u1@example.org' >>> browser.getControl(name='submit').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/users/+' >>> browser.contents '...<span class="error">MySQL already contains an user with this username.</span>...' @@ -259,7 +260,7 @@ >>> browser.getControl(name='username').value = 'root' >>> browser.getControl(name='email').value = 'root@example.org' >>> browser.getControl(name='submit').click() - >>> browser.url + >>> unquote(browser.url) 'http://localhost/manage/users/+' >>> browser.contents '...<span class="error">MySQL already contains an user with this username.</span>...'
--- a/src/ltpdarepo/tests/test_objs.py Fri Jan 04 18:45:38 2013 +0100 +++ b/src/ltpdarepo/tests/test_objs.py Fri Jan 04 18:47:43 2013 +0100 @@ -8,8 +8,13 @@ def setUpClass(self): from ltpdarepo import admin app = admin.Application() + app.setup() + + @classmethod + def tearDownClass(self): + from ltpdarepo import admin + app = admin.Application() app.wipe() - app.setup() def test_simple(self): objs = Objs(database='db1') @@ -43,8 +48,13 @@ def setUpClass(self): from ltpdarepo import admin app = admin.Application() + app.setup() + + @classmethod + def tearDownClass(self): + from ltpdarepo import admin + app = admin.Application() app.wipe() - app.setup() def test_simple(self): objs = Timeseries(database='db1')
--- a/src/ltpdarepo/tests/test_users.py Fri Jan 04 18:45:38 2013 +0100 +++ b/src/ltpdarepo/tests/test_users.py Fri Jan 04 18:47:43 2013 +0100 @@ -104,7 +104,7 @@ response = client.get('/manage/users/+') self.assertEqual(response.status_code, 200) # extract csrf token - regexp = r'<input id="csrf" name="csrf" type="hidden" value="(.*)" />' + regexp = r'input id="csrf" name="csrf" type="hidden" value="(.*)"' token = re.search(regexp, response.data).group(1) # create user @@ -130,7 +130,7 @@ response = client.get('/manage/users/u1/reset') self.assertEqual(response.status_code, 200) # extract csrf token - regexp = r'<input id="csrf" name="csrf" type="hidden" value="(.*)" />' + regexp = r'input id="csrf" name="csrf" type="hidden" value="(.*)"' token = re.search(regexp, response.data).group(1) # create user