|
| 1 | +from behave import given, when, then |
| 2 | + |
| 3 | +class Context: |
| 4 | + def __init__(self): |
| 5 | + self.feature_used = False |
| 6 | + self.lower_complexity = False |
| 7 | + self.appointment_started = False |
| 8 | + self.user_answered_indicator = False |
| 9 | + self.user_answered_dataset = False |
| 10 | + self.user_answered_order = False |
| 11 | + self.process_started = False |
| 12 | + self.process_completed = False |
| 13 | + self.explanation_given = False |
| 14 | + |
| 15 | +context = Context() |
| 16 | + |
| 17 | +# Given steps |
| 18 | +@given("the user used the measure complexity feature") |
| 19 | +def step_user_used_measure_complexity_feature(context): |
| 20 | + context.feature_used = True |
| 21 | + |
| 22 | +# When steps |
| 23 | +@when("the user wants to lower the complexity order of the dataset") |
| 24 | +def step_user_wants_to_lower_complexity_order(context): |
| 25 | + context.lower_complexity = True |
| 26 | + |
| 27 | +@when("the appointment starts") |
| 28 | +def step_appointment_starts(context): |
| 29 | + context.appointment_started = True |
| 30 | + |
| 31 | +@when("the user answers") |
| 32 | +def step_user_answers(context): |
| 33 | + if "what indicator" in context.active_step.text: |
| 34 | + context.user_answered_indicator = True |
| 35 | + elif "what dataset" in context.active_step.text: |
| 36 | + context.user_answered_dataset = True |
| 37 | + elif "what complexity order" in context.active_step.text: |
| 38 | + context.user_answered_order = True |
| 39 | + |
| 40 | +@when("the expert begins the process of lowering the complexity order") |
| 41 | +def step_expert_begins_lowering_complexity(context): |
| 42 | + assert context.appointment_started, "Appointment hasn't started" |
| 43 | + assert context.user_answered_indicator, "User didn't answer indicator question" |
| 44 | + assert context.user_answered_dataset, "User didn't answer dataset question" |
| 45 | + assert context.user_answered_order, "User didn't answer complexity order question" |
| 46 | + context.process_started = True |
| 47 | + |
| 48 | +@when("the process is over") |
| 49 | +def step_process_is_over(context): |
| 50 | + assert context.process_started, "Process hasn't started" |
| 51 | + context.process_completed = True |
| 52 | + |
| 53 | +@when("he explains what the user can do with such complexity order") |
| 54 | +def step_explain_user_capabilities(context): |
| 55 | + assert context.process_completed, "Process isn't completed" |
| 56 | + context.explanation_given = True |
| 57 | + |
| 58 | +# Then steps |
| 59 | +@then("he gets in touch with a data expert") |
| 60 | +def step_user_gets_in_touch_with_data_expert(context): |
| 61 | + assert context.feature_used, "User didn't use the feature" |
| 62 | + |
| 63 | +@then("the expert asks the user what indicator he wants to create") |
| 64 | +def step_expert_asks_user_about_indicator(context): |
| 65 | + assert context.appointment_started, "Appointment hasn't started" |
| 66 | + |
| 67 | +@then("the expert asks the user what dataset he wants to use") |
| 68 | +def step_expert_asks_user_about_dataset(context): |
| 69 | + assert context.user_answered_indicator, "User didn't answer indicator question" |
| 70 | + |
| 71 | +@then("the expert asks the user what complexity order he wants to reach") |
| 72 | +def step_expert_asks_user_about_complexity_order(context): |
| 73 | + assert context.user_answered_dataset, "User didn't answer dataset question" |
| 74 | + |
| 75 | +@then("the complexity order of the dataset is lowered") |
| 76 | +def step_complexity_order_lowered(context): |
| 77 | + assert context.process_completed, "Process isn't completed" |
| 78 | + |
| 79 | +@then("he explains what the user can do with such complexity order") |
| 80 | +def step_explain_user_capabilities(context): |
| 81 | + assert context.explanation_given, "Explanation not given" |
| 82 | + |
0 commit comments