tests: adapt to django-webtest 1.9.1 change of server name

This commit is contained in:
Frédéric Péters 2017-03-11 16:07:07 +01:00
parent 1a23d48dae
commit 14c247b4d7
3 changed files with 16 additions and 16 deletions

View File

@ -45,7 +45,7 @@ def test_add_regie(app, admin_user):
resp.forms[0]['service'] = 'dummy'
assert resp.form['is_default'].checked is True
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/lingo/regies/'
assert resp.location == 'http://testserver/manage/lingo/regies/'
assert Regie.objects.count() == 1
regie = Regie.objects.all()[0]
assert regie.label == 'Test'
@ -58,7 +58,7 @@ def test_edit_regie(app, admin_user):
resp = resp.click('Test')
resp.forms[0]['description'] = 'other description'
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/lingo/regies/'
assert resp.location == 'http://testserver/manage/lingo/regies/'
assert Regie.objects.count() == 1
regie = Regie.objects.all()[0]
assert regie.description == 'other description'
@ -71,7 +71,7 @@ def test_delete_regie(app, admin_user):
resp = resp.click('Delete')
assert 'Are you sure you want to delete this?' in resp.body
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/lingo/regies/'
assert resp.location == 'http://testserver/manage/lingo/regies/'
assert Regie.objects.count() == 0
def test_add_second_regie(app, admin_user):
@ -87,7 +87,7 @@ def test_add_second_regie(app, admin_user):
resp.forms[0]['service'] = 'dummy'
assert resp.form['is_default'].checked is False
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/lingo/regies/'
assert resp.location == 'http://testserver/manage/lingo/regies/'
assert Regie.objects.count() == 2
assert Regie.objects.get(id=regie.id).is_default is True

View File

@ -36,7 +36,7 @@ def login(app, username='admin', password='admin'):
def test_unlogged_access(app):
# connect while not being logged in
assert app.get('/manage/', status=302).location == 'http://localhost:80/login/?next=/manage/'
assert app.get('/manage/', status=302).location == 'http://testserver/login/?next=/manage/'
def test_access(app, admin_user):
app = login(app)
@ -50,7 +50,7 @@ def test_add_page(app, admin_user):
resp = resp.click('New')
assert resp.forms[0]['title'].value == 'Home' # default title for first page
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/pages/1/'
assert resp.location == 'http://testserver/manage/pages/1/'
assert Page.objects.get(slug='index').title == 'Home'
assert Page.objects.get(slug='index').template_name == 'standard' # first one was taken
@ -144,7 +144,7 @@ def test_delete_page(app, admin_user):
resp = resp.click('delete')
assert '<button class="delete-button">Delete</button>' in resp.body
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/'
assert resp.location == 'http://testserver/manage/'
assert Page.objects.count() == 0
def test_delete_page_keep_child(app, admin_user):
@ -162,7 +162,7 @@ def test_delete_page_keep_child(app, admin_user):
resp.form['choice'].value = 'delete-one'
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/'
assert resp.location == 'http://testserver/manage/'
assert Page.objects.count() == 1
assert Page.objects.get(id=page2.id) == page2
@ -181,7 +181,7 @@ def test_delete_page_and_subpage(app, admin_user):
resp.form['choice'].value = 'delete-all'
resp = resp.forms[0].submit()
assert resp.location == 'http://localhost:80/manage/'
assert resp.location == 'http://testserver/manage/'
assert Page.objects.count() == 0
def test_export_page(app, admin_user):
@ -253,7 +253,7 @@ def test_add_edit_cell(app, admin_user):
resp = app.get('/manage/pages/%s/' % page.id)
# click on first option link, this should add a text cell
resp = app.get(resp.html.find('option').get('data-add-url'))
assert resp.location == 'http://localhost:80/manage/pages/1/'
assert resp.location == 'http://testserver/manage/pages/1/'
cells = CellBase.get_cells(page_id=page.id)
assert len(cells) == 1
@ -264,7 +264,7 @@ def test_add_edit_cell(app, admin_user):
resp.forms[0]['c%s-text' % cells[0].get_reference()].value = 'Hello world'
resp = resp.forms[0].submit()
assert resp.status_int == 302
assert resp.location == 'http://localhost:80/manage/pages/1/'
assert resp.location == 'http://testserver/manage/pages/1/'
resp = app.get('/manage/pages/%s/' % page.id)
assert resp.forms[0]['c%s-text' % cells[0].get_reference()].value == 'Hello world'
@ -426,7 +426,7 @@ def test_edit_cell_order(app, admin_user):
def test_logout(app, admin_user):
app = login(app)
app.get('/logout/')
assert app.get('/manage/', status=302).location == 'http://localhost:80/login/?next=/manage/'
assert app.get('/manage/', status=302).location == 'http://testserver/login/?next=/manage/'
def test_asset_management(app, admin_user):
app = login(app)

View File

@ -23,7 +23,7 @@ def test_index(app):
page = Page(title='Home', slug='index', template_name='standard')
page.save()
resp = app.get('/index', status=301)
assert resp.location == 'http://localhost:80/'
assert resp.location == 'http://testserver/'
resp = app.get('/', status=200)
# check {% now %} inside a skeleton_extra_placeholder is interpreted
@ -65,7 +65,7 @@ def test_page_footer_acquisition(app):
page.save()
ParentContentCell(page=page, placeholder='footer', order=0).save()
resp = app.get('/second', status=301)
assert resp.location == 'http://localhost:80/second/'
assert resp.location == 'http://testserver/second/'
resp = app.get('/second/', status=200)
assert 'BARFOO' in resp.body
@ -91,7 +91,7 @@ def test_page_private_unlogged(app):
page = Page(title='Home', slug='index', template_name='standard', public=False)
page.save()
resp = app.get('/', status=302)
assert resp.location == 'http://localhost:80/login/?next=/'
assert resp.location == 'http://testserver/login/?next=/'
def test_page_private_logged_in(app, admin_user):
Page.objects.all().delete()
@ -169,7 +169,7 @@ def test_subpage_location(app):
assert 'Grand child of home' in resp.body
assert app.get('/child-home/grand-child-home', status=301).location == \
'http://localhost:80/child-home/grand-child-home/'
'http://testserver/child-home/grand-child-home/'
app.get('/grand-child-home/', status=404)
resp = app.get('/second/', status=200)