Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Adds a test for albums
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Jul 28, 2016
1 parent 670cb2d commit 1467578
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions onegov/town/forms/imageset.py
Expand Up @@ -13,6 +13,7 @@ class ImageSetForm(Form):

view = RadioField(
label=_("View"),
default='full',
choices=[
('full', _("Full size images")),
('grid', _("Grid layout"))
Expand Down
5 changes: 4 additions & 1 deletion onegov/town/locale/de_ch/LC_MESSAGES/onegov.town.po
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2016-07-28 09:32+0200\n"
"POT-Creation-Date: 2016-07-28 09:44+0200\n"
"PO-Revision-Date: 2015-10-15 09:42+0200\n"
"Last-Translator: Denis Krienbühl <denis.krienbuehl@seantis.ch>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -909,6 +909,9 @@ msgstr "Bild Löschen"
msgid "No images uploaded yet"
msgstr "Noch keine Bilder hochgeladen"

msgid "This album does not contain any images yet."
msgstr "Dieses Fotoalbum enthält noch keine Bilder."

msgid "No photo albums defined yet."
msgstr "Noch keine Fotoalben erstellt."

Expand Down
4 changes: 4 additions & 0 deletions onegov/town/templates/imageset.pt
Expand Up @@ -6,6 +6,10 @@
<tal:block metal:use-macro="layout.macros.page_content"
tal:define="lead imageset.meta.get('lead'); text None; people None; contact None; coordinates None;" />

<p tal:condition="not:imageset.files" i18n:translate>
This album does not contain any images yet.
</p>

<div tal:repeat="image imageset.files" tal:condition="imageset.view == 'full'" class="page-text full-imageset">
<!--! the first three images are loaded conventionally, the rest are loaded lazily -->
<p class="has-img" tal:condition="repeat.image.number <= 3">
Expand Down
38 changes: 38 additions & 0 deletions onegov/town/tests/test_views.py
Expand Up @@ -2927,3 +2927,41 @@ def test_map_set_marker(town_app):
assert 'data-lat="47"' in page
assert 'data-lon="8"' in page
assert 'data-zoom="12"' in page


def test_manage_album(town_app):
client = Client(town_app)
client.login_editor()

albums = client.get('/').click('Fotoalben')
assert "Noch keine Fotoalben" in albums

new = albums.click('Fotoalbum')
new.form['title'] = "Comicon 2016"
new.form.submit()

albums = client.get('/').click('Fotoalben')
assert "Comicon 2016" in albums

album = albums.click("Comicon 2016")
assert "Comicon 2016" in album
assert "noch keine Bilder" in album

images = albums.click("Bilder verwalten")
images.form['file'] = Upload('test.jpg', utils.create_image().read())
images.form.submit()

select = album.click("Bilder auswählen")
select.form[tuple(select.form.fields.keys())[1]] = True
select.form.submit()

album = albums.click("Comicon 2016")
assert "noch keine Bilder" not in album

images = albums.click("Bilder verwalten")

url = re.search(r'data-note-update-url="([^"]+)"', images.text).group(1)
client.post(url, {'note': "This is an alt text"})

album = albums.click("Comicon 2016")
assert "This is an alt text" in album

0 comments on commit 1467578

Please sign in to comment.