Exemple #1
0
def test_subclassing(fk, bridge):
    ac = fk.f_activite()
    x = Page.new(activite=ac.id, parent=bridge)
    y = Page.get(x.id, parent=bridge)
    assert x == y
    assert x.delete()
    with disable_log():
        assert Page.get(y.id) is None
Exemple #2
0
def test_properties(fk, bridge):
    ac = fk.f_activite()
    p = Page.new(titre="bla", activite=ac.id, lastPosition=5, parent=bridge)

    # titre
    p.titre = "Haha"
    assert p.titre == "Haha"
    assert ss(lambda: fk.db.Page[p.id].titre) == "Haha"

    # lastused
    assert p.lastPosition == 5
    p.lastPosition = 2
    assert p.lastPosition == 2

    # matiere
    assert p.matiereId == str(ac.matiere.id)

    # classert
    a = QObject()
    p.setParent(a)
    assert p.classeur == a
Exemple #3
0
def test_property_model(fk, bridge):
    ac = fk.f_activite()
    p = Page.new(activite=ac.id, parent=bridge)
    assert isinstance(p.model, PageModel)
    assert p.model.parent() == p