update tests after module removals (#37967)

This commit is contained in:
Frédéric Péters 2019-11-26 14:13:26 +01:00
parent bfcb1e467d
commit 49407ef0e4
2 changed files with 3 additions and 64 deletions

View File

@ -98,7 +98,7 @@ def test_aq_permissions_panel(empty_siteoptions):
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
if not pub.site_options.has_section('options'):
pub.site_options.add_section('options')
pub.site_options.set('options', 'auquotidien-links', 'true')
pub.site_options.set('options', 'auquotidien-payments', 'true')
pub.site_options.write(fd)
resp = app.get('/backoffice/settings/')
@ -112,10 +112,10 @@ def test_menu_items(empty_siteoptions):
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
if not pub.site_options.has_section('options'):
pub.site_options.add_section('options')
pub.site_options.set('options', 'auquotidien-links', 'true')
pub.site_options.set('options', 'auquotidien-payments', 'true')
pub.site_options.write(fd)
for area in ('links', 'announces', 'events', 'links', 'payments'):
for area in ('payments',):
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
if not pub.site_options.has_section('options'):

View File

@ -120,67 +120,6 @@ def test_myspace_with_user_forms():
resp.location.startswith('http://example.net/cat/test/?mt=')
resp = resp.follow(status=403)
def test_announces():
from modules.announces import Announce, AnnounceSubscription
if not 'misc' in pub.cfg:
pub.cfg['misc'] = {}
pub.cfg['misc']['announce_themes'] = ['Foo', 'Bar']
pub.write_cfg()
announce = Announce()
announce.title = 'Hello World'
announce.text = 'Lorem ipsum...'
announce.publication_time = time.gmtime(time.time()-100000)
announce.store()
user = create_user()
app = login(get_app(pub), username='user', password='user')
resp = app.get('/announces/', status=200)
resp = resp.click('Receiving those Announces')
resp = resp.click('Email')
assert 'You are logged in but there is no email address in your profile.' in resp.body
assert 'email' in resp.form.fields
user.email = 'foo@localhost'
user.store()
resp = app.get('/announces/email', status=200)
assert 'foo@localhost' in resp.body
assert not 'email' in resp.form.fields
resp = resp.form.submit()
assert AnnounceSubscription.count() == 1
resp = app.get('/myspace/', status=200)
resp = resp.click('Edit my Subscription to Announces')
assert resp.form['themes$elementFoo'].checked
assert resp.form['themes$elementBar'].checked
resp.form['themes$elementFoo'].checked = False
resp = resp.form.submit('submit')
assert AnnounceSubscription.count() == 1
resp = app.get('/myspace/announces', status=200)
assert not resp.form['themes$elementFoo'].checked
assert resp.form['themes$elementBar'].checked
def test_agenda():
from modules.events import Event, RemoteCalendar
remote_calendar = RemoteCalendar()
remote_calendar.label = 'Remote'
remote_calendar.store()
event = Event()
event.title = 'Hello World'
event.description = 'Lorem ipsum...'
event.date_start = time.strptime('2016-09-10', '%Y-%m-%d')
event.date_end = time.strptime('2016-09-12', '%Y-%m-%d')
event.store()
app = get_app(pub)
resp = app.get('/agenda/', status=200)
resp = app.get('/agenda/filter')
assert 'tags$element0' in resp.form.fields
assert 'calendars$element0' in resp.form.fields
def test_form_category_redirection():
Category.wipe()
cat = Category(name='baz')