Ejemplo n.º 1
0
def test_del_worker(sample_worker, sample_start_doc, sample_event):
    sample_worker.assign_start_doc(sample_start_doc)
    sample_worker.assign_event(sample_event)
    create(sample_worker)

    assert sample_worker in Worker.query.all()
    assert sample_event in sample_worker.events
    assert sample_start_doc in sample_worker.start_docs

    del_worker(sample_worker.id)

    assert sample_worker not in Worker.query.all()
    assert sample_event not in Event.query.all()
    assert sample_start_doc not in StartDoc.query.all()
Ejemplo n.º 2
0
def test_change_start_doc_type_name(sample_start_doc_type):
    name = sample_start_doc_type.name
    changed = "changed name"
    data = {
        "name": name,
        "changed": changed
    }

    assert change_start_doc_type_name(data) is True
    assert sample_start_doc_type.name == changed

    another_type = StartDocType(name="another name")
    create(another_type)

    data["name"] = another_type.name
    data["changed"] = changed
    assert change_start_doc_type_name(data) is False
Ejemplo n.º 3
0
def sample_start_doc_type():
    doc = StartDocType(name="sample_doc")
    yield create(doc)
    delete(doc)
Ejemplo n.º 4
0
def sample_start_doc():
    doc = StartDoc()
    yield create(doc)
    delete(doc)
Ejemplo n.º 5
0
def sample_workplace():
    workplace = Workplace(name="sample_workplace")
    yield create(workplace)
    delete(workplace)
Ejemplo n.º 6
0
def sample_event():
    e = Event()
    yield create(e)
    delete(e)
Ejemplo n.º 7
0
def sample_event_kind():
    ek = EventKind(name="UW")
    yield create(ek)
    delete(ek)
Ejemplo n.º 8
0
def sample_function():
    function = Function(name="Test")
    yield create(function)
    delete(function)
Ejemplo n.º 9
0
def sample_worker():
    worker = Worker(name="Test")
    yield create(worker)
    delete(worker)
Ejemplo n.º 10
0
def sample_role():
    role = Role(name="admin")
    yield create(role)
    delete(role)
Ejemplo n.º 11
0
def sample_user():
    user = User(username="******")
    user.set_password("test")
    yield create(user)
    delete(user)