From a8efae9805f53f44478e59d77ea1d7821375e014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Date: Mon, 2 May 2016 00:21:56 +0200 Subject: [PATCH] Add test for sorting images on meta keys. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test also tests the missing meta key functionality. Signed-off-by: Toke Høiland-Jørgensen --- tests/sample/pictures/dir1/test2/21.md | 1 + tests/sample/pictures/dir1/test2/22.md | 1 + tests/test_gallery.py | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 tests/sample/pictures/dir1/test2/21.md create mode 100644 tests/sample/pictures/dir1/test2/22.md diff --git a/tests/sample/pictures/dir1/test2/21.md b/tests/sample/pictures/dir1/test2/21.md new file mode 100644 index 0000000..576d6c7 --- /dev/null +++ b/tests/sample/pictures/dir1/test2/21.md @@ -0,0 +1 @@ +Order: 01 diff --git a/tests/sample/pictures/dir1/test2/22.md b/tests/sample/pictures/dir1/test2/22.md new file mode 100644 index 0000000..0d4b373 --- /dev/null +++ b/tests/sample/pictures/dir1/test2/22.md @@ -0,0 +1 @@ +Order: 02 diff --git a/tests/test_gallery.py b/tests/test_gallery.py index 17d905b..bc2c171 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -220,6 +220,12 @@ def test_medias_sort(settings): assert [im.filename for im in a.images] == ['22.jpg', '21.jpg', 'archlinux-kiss-1024x640.png'] + settings['medias_sort_attr'] = 'meta.order' + settings['medias_sort_reverse'] = False + a = Album('dir1/test2', settings, album['subdirs'], album['medias'], gal) + a.sort_medias(settings['medias_sort_attr']) + assert [im.filename for im in a.images] == ['archlinux-kiss-1024x640.png', '21.jpg', '22.jpg'] + def test_gallery(settings, tmpdir): "Test the Gallery class."