예제 #1
0
def test_notes():
    test_note = "note." + str(time.time())
    notes = storage.get_notes()
    for note in notes:
        assert not test_note in note['text']
    id = storage.add_note({'text': test_note})
    notes = storage.get_notes()
    count = sum([1 for n in notes if test_note in n['text']])
    assert count == 1
    notes = storage.get_notes(test_note)
    assert len(notes) > 0
    assert test_note in notes[0]['text']
    storage.delete_note(id)
    notes = storage.get_notes()
    for note in notes:
        assert not test_note in note['text']
예제 #2
0
def get_remove(id):
    storage.delete_note(id)
    return redirect("/notes")
예제 #3
0
def get_remove(id):
    response = verify_login(request)
    if response:
        return response
    storage.delete_note(id)
    return redirect("/notes")