コード例 #1
0
def test_set_scenario_resets_interaction_count(service: BaseService):
    initial_interactions = {
        'scenario_entered': {
            'interaction_0': {
                'num_calls': 3,
            },
            'interaction_1': {
                'num_calls': 1,
            }
        },
        'scenario_irrelevant': {
            'interaction': 42,
        },
    }

    expected = {
        'scenario_entered': {},
        'scenario_irrelevant': {
            'interaction': 42,
        },
    }

    service.interactions_replayed = initial_interactions
    service.set_active_scenario('scenario_entered')
    result = service.interactions_replayed

    assert expected == result
コード例 #2
0
def service():
    test_service = BaseService(
        name='TestService',
        hosts_list=['host_a.local', 'host_b.local'],
    )
    test_service.set_active_scenario('test_scenario')
    return test_service