Exemplo n.º 1
0
def test_cat_does_not_move_if_no_available_station(mocker):
    mocker.patch(
        'herdcats.players._get_current_stations'
    ).return_value = 5, 6
    mocker.patch(
        'herdcats.players._get_visisted_stations'
    )
    mocker.patch(
        'herdcats.tube.get_random_connection'
    ).return_value = None
    owner_and_cat = {
        'owner': [],
        'cat': []
    }

    players._attempt_cat_move(owner_and_cat)

    assert owner_and_cat['cat'] == []
Exemplo n.º 2
0
def test_cat_attempts_to_move_to_conneced_station(mocker):
    get_current_stations = mocker.patch(
        'herdcats.players._get_current_stations'
    )
    get_current_stations.return_value = 1, 2
    mocker.patch(
        'herdcats.players._get_visisted_stations'
    ).return_value = []
    get_connection = mocker.patch(
        'herdcats.tube.get_random_connection'
    )
    owner_and_cat = {
        'owner': [],
        'cat': []
    }

    players._attempt_cat_move(owner_and_cat)

    assert get_current_stations.call_args_list[0][0][0] is owner_and_cat
    get_connection.assert_called_once_with(2)