tests: adapt to django-webtest 1.9.1 change of server name
This commit is contained in:
parent
338a2a42f5
commit
481c92b5f3
|
@ -25,8 +25,8 @@ def login(app, username='admin', password='admin'):
|
|||
|
||||
def test_unlogged_access(app):
|
||||
# connect while not being logged in
|
||||
assert app.get('/', status=301).location == 'http://localhost:80/manage/'
|
||||
assert app.get('/manage/', status=302).location == 'http://localhost:80/login/?next=/manage/'
|
||||
assert app.get('/', status=301).location == 'http://testserver/manage/'
|
||||
assert app.get('/manage/', status=302).location == 'http://testserver/login/?next=/manage/'
|
||||
|
||||
def test_access(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -36,7 +36,7 @@ def test_access(app, admin_user):
|
|||
def test_logout(app, admin_user):
|
||||
app = login(app)
|
||||
app.get('/logout/')
|
||||
assert app.get('/', status=301).location == 'http://localhost:80/manage/'
|
||||
assert app.get('/', status=301).location == 'http://testserver/manage/'
|
||||
|
||||
def test_create_category(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -47,8 +47,8 @@ def test_create_category(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
resp = app.get('http://localhost:80/manage/')
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get('http://testserver/manage/')
|
||||
assert 'Alerts' in resp.content
|
||||
|
||||
def test_edit_category(app, admin_user):
|
||||
|
@ -60,8 +60,8 @@ def test_edit_category(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
resp = app.get('http://localhost:80/manage/')
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get('http://testserver/manage/')
|
||||
assert 'Alerts' in resp.content
|
||||
assert '0 announces' in resp.content
|
||||
assert '0 subscriptions' in resp.content
|
||||
|
@ -72,7 +72,7 @@ def test_edit_category(app, admin_user):
|
|||
edit_form['name'] = 'New Alerts'
|
||||
resp = edit_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
|
||||
def test_delete_category(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -83,8 +83,8 @@ def test_delete_category(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
resp = app.get('http://localhost:80/manage/')
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get('http://testserver/manage/')
|
||||
assert 'Alerts' in resp.content
|
||||
assert '0 announces' in resp.content
|
||||
assert '0 subscriptions' in resp.content
|
||||
|
@ -94,7 +94,7 @@ def test_delete_category(app, admin_user):
|
|||
delete_form = delete_page.forms[0]
|
||||
resp = delete_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
|
||||
def test_create_announce(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -105,8 +105,8 @@ def test_create_announce(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
resp = app.get('http://localhost:80/manage/')
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get('http://testserver/manage/')
|
||||
assert 'Alerts' in resp.content
|
||||
resp = resp.click('Alerts')
|
||||
assert 'New announce' in resp.content
|
||||
|
@ -116,8 +116,8 @@ def test_create_announce(app, admin_user):
|
|||
announce_form['text'] = 'announce content'
|
||||
resp = announce_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
resp = app.get('http://localhost:80/manage/category/alerts/')
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
resp = app.get('http://testserver/manage/category/alerts/')
|
||||
assert 'First announce' in resp.content
|
||||
|
||||
def test_edit_announce(app, admin_user):
|
||||
|
@ -129,7 +129,7 @@ def test_edit_announce(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get(resp.location)
|
||||
resp = resp.click('Alerts')
|
||||
assert 'New announce' in resp.content
|
||||
|
@ -139,7 +139,7 @@ def test_edit_announce(app, admin_user):
|
|||
announce_form['text'] = 'announce content'
|
||||
resp = announce_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
resp = app.get(resp.location)
|
||||
assert 'First announce' in resp.content
|
||||
announce_edit_page = resp.click('First announce')
|
||||
|
@ -147,7 +147,7 @@ def test_edit_announce(app, admin_user):
|
|||
edit_form['publication_time'] = '2017-03-03 09:00:00'
|
||||
resp = edit_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
|
||||
def test_delete_announce(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -158,8 +158,8 @@ def test_delete_announce(app, admin_user):
|
|||
category_form['name'] = 'Alerts'
|
||||
resp = category_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
resp = app.get('http://localhost:80/manage/')
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = app.get('http://testserver/manage/')
|
||||
resp = resp.click('Alerts')
|
||||
assert 'New announce' in resp.content
|
||||
announce_page = resp.click('New announce')
|
||||
|
@ -168,8 +168,8 @@ def test_delete_announce(app, admin_user):
|
|||
announce_form['text'] = 'announce content'
|
||||
resp = announce_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
resp = app.get('http://localhost:80/manage/category/alerts/')
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
resp = app.get('http://testserver/manage/category/alerts/')
|
||||
assert 'First announce' in resp.content
|
||||
resp = resp.click('First announce')
|
||||
assert 'Delete' in resp.content
|
||||
|
@ -177,4 +177,4 @@ def test_delete_announce(app, admin_user):
|
|||
announce_delete_form = announce_delete_page.forms[0]
|
||||
resp = announce_delete_form.submit()
|
||||
assert resp.status_int == 302
|
||||
assert resp.location == 'http://localhost:80/manage/category/alerts/'
|
||||
assert resp.location == 'http://testserver/manage/category/alerts/'
|
||||
|
|
Reference in New Issue