Example #1
0
def load_data_to_context(context, name, course, active, *memberships):
    load_id_data_to_context(context, name)
    context.course = helpers.find_course_with_name(context.api_client, course)
    # z memberships vyfiltruj prazdne stringy
    context.memberships = common_helpers.filter_empty_strings_from_list(
        memberships)
    context.active = common_helpers.to_bool(active)
Example #2
0
def step_impl(context, name):
    # nacti jmeno kurzu do kontextu
    load_id_data_to_context(context, name)
    # najdi kurz
    course_to_delete = helpers.find_course_with_name(context.api_client,
                                                     context.name)
    assert course_to_delete
    # uloz puvodni pocet kurzu
    save_old_courses_cnt_to_context(context)
    # smazani kurzu
    context.resp = context.api_client.delete(
        f"{helpers.API_COURSES}{course_to_delete['id']}/")
Example #3
0
def step_impl(context, cur_name, new_name, new_visible, new_duration,
              new_color):
    # nacteni dat kurzu do kontextu
    load_data_to_context(context, new_name, new_visible, new_duration,
                         new_color)
    # najdi kurz
    course_to_update = helpers.find_course_with_name(context.api_client,
                                                     cur_name)
    assert course_to_update
    # uloz puvodni pocet kurzu
    save_old_courses_cnt_to_context(context)
    # vlozeni kurzu
    context.resp = context.api_client.put(
        f"{helpers.API_COURSES}{course_to_update['id']}/",
        course_dict(context))
Example #4
0
def step_impl(context, cur_full_name, cur_course, new_full_name, new_course,
              new_note):
    # nacteni dat zadosti do kontextu
    load_data_to_context(context, new_full_name, new_course, new_note)
    # najdi zadost
    cur_client_found = helpers.find_client_with_full_name(
        context.api_client, cur_full_name)
    cur_course_found = helpers.find_course_with_name(context.api_client,
                                                     cur_course)
    application_to_update = helpers.find_application_with_client_and_course(
        context.api_client, cur_client_found, cur_course_found)
    assert application_to_update
    # uloz puvodni pocet zadosti
    save_old_applications_cnt_to_context(context)
    # vlozeni zadosti
    context.resp = context.api_client.put(
        f"{helpers.API_APPLICATIONS}{application_to_update['id']}/",
        application_dict(context))
Example #5
0
def load_data_to_context(context,
                         obj,
                         date,
                         time,
                         duration,
                         canceled,
                         attendances,
                         is_group=False):
    load_id_data_to_context(context, date, time)
    # pro skupinu je potreba ulozit skupinu, pro jednotlivce pouze kurz (klient je v attendances)
    if is_group:
        context.group = helpers.find_group_with_name(context.api_client, obj)
    else:
        context.course = helpers.find_course_with_name(context.api_client, obj)
    context.is_group = is_group
    context.attendances = attendances
    context.duration = duration
    context.canceled = common_helpers.to_bool(canceled)
Example #6
0
def load_id_data_to_context(context, full_name, course):
    context.client = helpers.find_client_with_full_name(
        context.api_client, full_name)
    context.course = helpers.find_course_with_name(context.api_client, course)
Example #7
0
def step_impl(context):
    # smazani bylo uspesne
    assert context.resp.status_code == status.HTTP_204_NO_CONTENT
    assert not helpers.find_course_with_name(context.api_client, context.name)
    assert courses_cnt(context.api_client) < context.old_courses_cnt