Example #1
0
    def test_pagination_hidden(self):
        NotesService.upsert_note(VALID_ID, "Test", utils.now())
        pagination = NotesService.paginate_notes(page=1)
        self.assertEqual(len(pagination.items), 1)

        NotesService.hide_note(VALID_ID)
        pagination = NotesService.paginate_notes(page=1)
        self.assertEqual(len(pagination.items), 0)
Example #2
0
    def test_hide_note(self):
        NotesService.upsert_note(VALID_ID, "Hello, world!", utils.now())

        note = NotesService.get_note(VALID_ID)
        self.assertFalse(note.hidden)

        NotesService.hide_note(VALID_ID)
        note = NotesService.get_note(VALID_ID)
        self.assertTrue(note.hidden)
Example #3
0
def hide_note(note_id):
    NotesService.hide_note(note_id)
    page = form_int("page", 1)
    page_size = form_int("pageSize")

    if page_size == 1:
        # We are hiding the last note on the page
        page -= 1

    return redirect(
        url_for(".get_notes") + ("?page={}".format(page) if page > 1 else ""))