Exemple #1
0
def test_filename_uid_colision(create, default_database, runner, todos):
    create("ABC.ics", "SUMMARY:My UID is not ABC\nUID:NOTABC\n")
    assert len(list(todos())) == 1

    todo = Todo(new=False)
    todo.uid = "ABC"
    todo.list = next(default_database.lists())
    default_database.save(todo)

    assert len(list(todos())) == 2
Exemple #2
0
def test_filename_uid_colision(create, default_database, runner, todos):
    create('ABC.ics', 'SUMMARY:My UID is not ABC\n' 'UID:NOTABC\n')
    len(list(todos())) == 1

    todo = Todo(new=False)
    todo.uid = 'ABC'
    todo.list = next(default_database.lists())
    default_database.save(todo)

    len(list(todos())) == 2
Exemple #3
0
def test_clone():
    now = datetime.now(tz=tzlocal())

    todo = Todo(new=True)
    todo.summary = "Organize a party"
    todo.location = "Home"
    todo.due = now
    todo.uid = "123"
    todo.id = "123"
    todo.filename = "123.ics"

    clone = todo.clone()

    assert todo.summary == clone.summary
    assert todo.location == clone.location
    assert todo.due == clone.due
    assert todo.uid != clone.uid
    assert len(clone.uid) > 32
    assert clone.id is None
    assert todo.filename != clone.filename
    assert clone.uid in clone.filename