# HG changeset patch # User Daniele Nicolodi # Date 1357321663 -3600 # Node ID 739af4852be1c4bf4e0c82bb7d0db201a0db8890 # Parent 110c94509ebfe844f860b0fdbb7354583e2161ca Fix tests. diff -r 110c94509ebf -r 739af4852be1 src/ltpdarepo/tests/manage-databases.txt --- 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 '...Invalid ID....' @@ -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 '...MySQL already contains a datbase with this ID....' @@ -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 '...MySQL already contains a datbase with this ID....' diff -r 110c94509ebf -r 739af4852be1 src/ltpdarepo/tests/manage-queries.txt --- 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:: diff -r 110c94509ebf -r 739af4852be1 src/ltpdarepo/tests/manage-users.txt --- 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 '...MySQL already contains an user with this username....' @@ -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 '...MySQL already contains an user with this username....' diff -r 110c94509ebf -r 739af4852be1 src/ltpdarepo/tests/test_objs.py --- 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') diff -r 110c94509ebf -r 739af4852be1 src/ltpdarepo/tests/test_users.py --- 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'' + 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'' + regexp = r'input id="csrf" name="csrf" type="hidden" value="(.*)"' token = re.search(regexp, response.data).group(1) # create user