def test_should_find_entries(): """Entries: The articles can be retrieved by their path""" entries = Entries() entries._entries = {"path": Entry("Title", "23. Februar 2013", "path")} entry = entries.find("path") assert_equal(entry.title, "Title") assert_equal(entry.date, Date.from_str("23. Februar 2013"))
def test_should_sort_entries_by_date(): """Entries (Sorting): Should sort entries by date""" entries = Entries() entries._entries = { "c": Entry("C", "12. Januar 2013", "Path"), "b": Entry("B", "01. Oktober 2013", "Path"), "a": Entry("A", "24. Februar 2013", "Path"), } entries = entries.by_date() assert_equal(entries[0].date, "12. Januar 2013") assert_equal(entries[1].date, "24. Februar 2013") assert_equal(entries[2].date, "1. Oktober 2013")
def test_should_sort_entries_by_title(): """Entries (Sorting): Should sort entries by title""" entries = Entries() entries._entries = { "c": Entry("B Title", "23. Februar 2013", "Path"), "b": Entry("A Title", "23. Februar 2013", "Path"), "a": Entry("C Title", "23. Februar 2013", "Path"), } entries = entries.by_title() assert_equal(entries[0].title, "A Title") assert_equal(entries[1].title, "B Title") assert_equal(entries[2].title, "C Title")