예제 #1
0
def step_impl(context):
    processing_rules = ProcessingRules()
    for row in table_as_list_of_rows(context):
        method = row[0]
        user_implementation = get_implementation(row[1])
        action = row[2]
        processing_rules.on(method).call(user_implementation).then(action)

    with Capturing() as context.stdout_capture:
        context.client.go_live_with(processing_rules)
예제 #2
0
def step_impl(context):
    processing_rules = ProcessingRules()
    for row in table_as_list_of_rows(context):
        method = row[0]
        user_implementation = get_implementation(row[1])
        action = row[2]
        processing_rules.on(method).call(user_implementation).then(action)

    with Capturing() as context.stdout_capture:
        context.client.go_live_with(processing_rules)
예제 #3
0
파일: run.py 프로젝트: spike01/tdl-warmup
def start_client(ready):
    client = Client(hostname=HOSTNAME, unique_id=EMAIL)

    rules = ProcessingRules()
    rules.on("display_description").call(display_and_save_description).then("publish")
    # STEP 5. Uncomment the following line to register the sum method and run again
    # rules.on("sum").call(App.sum).then(publish_if(ready))

    # STEP 6. Run the test (test/test_app.py) and see it fail
    # STEP 7. Fix the sum method implementation in lib/app.py

    client.go_live_with(rules)
def run_client():
    client = Client(hostname='localhost', unique_id='*****@*****.**')

    rules = ProcessingRules()
    rules.on("display_description").call(lambda label, description: "OK").then("publish")
    rules.on("sum").call(add_numbers).then("publish")
    rules.on("end_round").call(lambda params: "OK").then("publish_and_stop")

    client.go_live_with(rules)
예제 #5
0
def execute_runner_action(hostname, runner_action, solutions, username):
    print("Chosen action is: {}".format(runner_action.name))
    client = Client(hostname, unique_id=username)
    rules = ProcessingRules()
    rules.on("display_description").call(RoundManagement.display_and_save_description).then("publish")
    for key, value in solutions.iteritems():
        rules.on(key).call(value).then(runner_action.client_action)
    client.go_live_with(rules)
    RecordingSystem.notify_event(RoundManagement.get_last_fetched_round(), runner_action.short_name)
예제 #6
0
def start_client(args, username, hostname, action_if_no_args, solutions):
    configure_logging()

    if not is_recording_system_ok():
        print("Please run `record_screen_and_upload` before continuing.")
        return

    value_from_args = extract_action_from(args)
    runner_action = value_from_args if value_from_args is not None else action_if_no_args
    print("Chosen action is: {}".format(runner_action.name))

    client = Client(hostname, unique_id=username)

    rules = ProcessingRules()
    rules.on("display_description").call(RoundManagement.display_and_save_description).then("publish")

    for key, value in solutions.iteritems():
        rules.on(key).call(value).then(runner_action.client_action)

    client.go_live_with(rules)

    RecordingSystem.notify_event(RoundManagement.get_last_fetched_round(), runner_action.short_name)
예제 #7
0
def start_client(args, email, hostname, action_if_no_args):
    configure_logging()

    value_from_args = extract_action_from(args)
    runner_action = value_from_args if value_from_args is not None else action_if_no_args
    print("Chosen action is: {}".format(runner_action.name))

    client = Client(hostname, unique_id=email)

    rules = ProcessingRules()
    rules.on("display_description").call(display_and_save_description).then("publish")
    rules.on("sum").call(sum).then(runner_action.client_action)
    rules.on("hello").call(hello).then(runner_action.client_action)
    rules.on("fizz_buzz").call(fizz_buzz).then(runner_action.client_action)
    rules.on("checkout").call(checkout).then(runner_action.client_action)

    client.go_live_with(rules)