tests: adapt to django-webtest 1.9.1 change of server name
This commit is contained in:
parent
de7e84dc5b
commit
4343b37bb9
|
@ -70,9 +70,9 @@ def test_agendas_api(app, some_data):
|
|||
resp = app.get('/api/agenda/')
|
||||
assert resp.json == {'data': [
|
||||
{'text': 'Foo bar', 'id': agenda1.id, 'slug': u'foo-bar',
|
||||
'api': {'datetimes': 'http://localhost:80/api/agenda/%s/datetimes/' % agenda1.slug}},
|
||||
'api': {'datetimes': 'http://testserver/api/agenda/%s/datetimes/' % agenda1.slug}},
|
||||
{'text': 'Foo bar2', 'id': agenda2.id, 'slug': u'foo-bar2',
|
||||
'api': {'datetimes': 'http://localhost:80/api/agenda/%s/datetimes/' % agenda2.slug}}
|
||||
'api': {'datetimes': 'http://testserver/api/agenda/%s/datetimes/' % agenda2.slug}}
|
||||
]}
|
||||
|
||||
def test_datetimes_api(app, some_data):
|
||||
|
|
|
@ -51,7 +51,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_simple_user_access(app, simple_user):
|
||||
# connect while being logged as a simple user, access should be forbidden
|
||||
|
@ -79,7 +79,7 @@ def test_manager_user_access(app, manager_user):
|
|||
assert app.get('/manage/', status=200)
|
||||
|
||||
def test_home_redirect(app):
|
||||
assert app.get('/', status=302).location == 'http://localhost:80/manage/'
|
||||
assert app.get('/', status=302).location == 'http://testserver/manage/'
|
||||
|
||||
def test_access(app, admin_user):
|
||||
app = login(app)
|
||||
|
@ -90,17 +90,17 @@ def test_access(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_logout_next(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_menu_json(app, admin_user):
|
||||
app = login(app)
|
||||
resp = app.get('/manage/menu.json', status=200)
|
||||
assert resp.json[0]['url'] == 'http://localhost:80/manage/'
|
||||
assert resp.json[0]['url'] == 'http://testserver/manage/'
|
||||
assert resp.json[0]['label'] == 'Agendas'
|
||||
resp2 = app.get('/manage/menu.json?callback=Q', status=200)
|
||||
assert resp2.body == 'Q(%s);' % resp.body
|
||||
|
@ -129,7 +129,7 @@ def test_add_agenda(app, admin_user):
|
|||
resp = resp.form.submit()
|
||||
|
||||
agenda = Agenda.objects.get(label='Foo bar')
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
resp = resp.follow()
|
||||
assert '<h2>Foo bar' in resp.body
|
||||
|
||||
|
@ -153,7 +153,7 @@ def test_options_agenda(app, admin_user):
|
|||
assert resp.form['label'].value == 'Foo bar'
|
||||
resp.form['label'] = 'Foo baz'
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
resp = resp.follow()
|
||||
assert '<h2>Foo baz' in resp.body
|
||||
|
||||
|
@ -176,7 +176,7 @@ def test_options_agenda_as_manager(app, manager_user):
|
|||
assert resp.form['label'].value == 'Foo bar'
|
||||
resp.form['label'] = 'Foo baz'
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
resp = resp.follow()
|
||||
assert '<h2>Foo baz' in resp.body
|
||||
|
||||
|
@ -188,7 +188,7 @@ def test_delete_agenda(app, admin_user):
|
|||
resp = resp.click('Foo bar')
|
||||
resp = resp.click('Delete')
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/'
|
||||
assert resp.location == 'http://testserver/manage/'
|
||||
resp = resp.follow()
|
||||
assert not 'Foo bar' in resp.body
|
||||
|
||||
|
@ -380,7 +380,7 @@ def test_delete_event(app, admin_user):
|
|||
resp = resp.click(href='/manage/events/%s' % event.id)
|
||||
resp = resp.click('Delete')
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
assert Event.objects.count() == 0
|
||||
|
||||
def test_delete_busy_event(app, admin_user):
|
||||
|
@ -429,7 +429,7 @@ def test_delete_event_as_manager(app, manager_user):
|
|||
resp = resp.click(href='/manage/events/%s' % event.id)
|
||||
resp = resp.click('Delete')
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
assert Event.objects.count() == 0
|
||||
|
||||
def test_import_events(app, admin_user):
|
||||
|
@ -517,7 +517,7 @@ def test_add_meetings_agenda(app, admin_user):
|
|||
resp.form['kind'] = 'meetings'
|
||||
resp = resp.form.submit()
|
||||
agenda = Agenda.objects.get(label='Foo bar')
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
resp = resp.follow()
|
||||
assert '<h2>Foo bar' in resp.body
|
||||
assert 'Meeting Types' in resp.body
|
||||
|
@ -557,7 +557,7 @@ def test_meetings_agenda_delete_meeting_type(app, admin_user):
|
|||
resp = resp.click('Blah')
|
||||
resp = resp.click('Delete')
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
assert MeetingType.objects.count() == 0
|
||||
|
||||
def test_meetings_agenda_add_time_period(app, admin_user):
|
||||
|
@ -610,5 +610,5 @@ def test_meetings_agenda_delete_time_period(app, admin_user):
|
|||
resp = resp.click('Wednesday')
|
||||
resp = resp.click('Delete')
|
||||
resp = resp.form.submit()
|
||||
assert resp.location == 'http://localhost:80/manage/agendas/%s/' % agenda.id
|
||||
assert resp.location == 'http://testserver/manage/agendas/%s/' % agenda.id
|
||||
assert TimePeriod.objects.count() == 0
|
||||
|
|
|
@ -10,12 +10,12 @@ pytestmark = pytest.mark.django_db
|
|||
def test_sso(app):
|
||||
with override_settings(MELLON_IDENTITY_PROVIDERS=[{'METADATA': 'x', 'ENTITY_ID': 'x'}]):
|
||||
resp = app.get('/login/')
|
||||
assert resp.location == 'http://localhost:80/accounts/mellon/login/'
|
||||
assert resp.location == 'http://testserver/accounts/mellon/login/'
|
||||
|
||||
resp = app.get('/login/?next=/manage/')
|
||||
assert resp.location == 'http://localhost:80/accounts/mellon/login/?next=/manage/'
|
||||
assert resp.location == 'http://testserver/accounts/mellon/login/?next=/manage/'
|
||||
|
||||
def test_slo(app):
|
||||
with override_settings(MELLON_IDENTITY_PROVIDERS=[{'METADATA': 'x', 'ENTITY_ID': 'x'}]):
|
||||
resp = app.get('/logout/')
|
||||
assert resp.location == 'http://localhost:80/accounts/mellon/logout/'
|
||||
assert resp.location == 'http://testserver/accounts/mellon/logout/'
|
||||
|
|
Loading…
Reference in New Issue