Ejemplo n.º 1
0
def test_update_work_with_roles(use_test_db, test_work_dict):
    new_test_work = logic.create_work(test_work_dict)
    test_creator_id = testing_utils.create_fake_creator()['id']
    test_work_dict['roles'] = {'illustrator': [test_creator_id]}
    updated_test_work = logic.update_work(test_work_dict['id'], test_work_dict)
    assert new_test_work['id'] == updated_test_work['id']
    assert updated_test_work['roles'] == [test_creator_id]
Ejemplo n.º 2
0
def test_create_work_with_roles(use_test_db, test_work_dict):
    test_creator_id = testing_utils.create_fake_creator()['id']
    test_work_dict['roles'] = {'illustrator': [test_creator_id]}
    new_test_work = logic.create_work(test_work_dict)
    with session_scope() as session:
        created_role_id = session.query(Role)\
            .filter_by(work_id=new_test_work['id'], creator_id=test_creator_id)\
            .first().id
    assert new_test_work['roles'] == [created_role_id]
Ejemplo n.º 3
0
def test_create_work(use_test_db, test_work_dict):
    new_test_work = logic.create_work(test_work_dict)
    assert new_test_work['title'] == 'pooop'
Ejemplo n.º 4
0
Archivo: app.py Proyecto: kennydo/medea
def works():
    model_data = api_to_model_dict(request.get_json())
    response = logic.create_work(model_data)
    return {'work': response}, 201