Esempio n. 1
0
def test_PowerMulti_calls_targets_off_methods():
    num_mock_powers = 3
    mock_powers = [MockPower() for __ in range(0, num_mock_powers)]

    power = PowerMulti(power_seq=mock_powers)

    power.off()

    assert (all([mp.off_called == 1 for mp in mock_powers]))
Esempio n. 2
0
def test_PowerMulti_calls_targets_off_methods_in_reverse_order_with_reverse_off_seq_default(
):
    mocks_off_list = []
    num_mock_powers = 3
    mock_powers = [
        MockPower(mocks_off_list=mocks_off_list)
        for __ in range(0, num_mock_powers)
    ]

    power = PowerMulti(power_seq=mock_powers)

    power.off()

    assert (mock_powers[::-1] == mocks_off_list)
Esempio n. 3
0
def test_PowerMulti_calls_targets_off_methods_in_sequence_order_with_reverse_off_seq_false(
):
    mocks_off_list = []
    num_mock_powers = 3
    mock_powers = [
        MockPower(mocks_off_list=mocks_off_list)
        for __ in range(0, num_mock_powers)
    ]

    power = PowerMulti(power_seq=mock_powers, reverse_off_seq=False)

    power.off()

    assert (mock_powers == mocks_off_list)