Ejemplo n.º 1
0
def test_load_strava_tracks_with_str_activity_type_filter(
    loader: TrackLoader,
    strava_config_with_run_type_filter: str,
    mock_track_instance: MagicMock,
    mock_run_activity: MagicMock,
) -> None:
    loader.load_strava_tracks(strava_config_with_run_type_filter)

    mock_track_instance.load_strava.assert_called_once_with(mock_run_activity)
Ejemplo n.º 2
0
def test_load_strava_tracks_with_list_activity_type_filter(
    loader: TrackLoader,
    strava_config_with_walk_hike_type_filter: str,
    mock_track_instance: MagicMock,
    mock_walk_activity: MagicMock,
    mock_hike_activity: MagicMock,
) -> None:
    loader.load_strava_tracks(strava_config_with_walk_hike_type_filter)

    mock_track_instance.load_strava.assert_any_call(mock_walk_activity)
    mock_track_instance.load_strava.assert_any_call(mock_hike_activity)
Ejemplo n.º 3
0
def fixture_loader(mocker: MockerFixture, mock_run_activity: MagicMock,
                   mock_walk_activity: MagicMock,
                   mock_hike_activity: MagicMock) -> TrackLoader:
    """Return a :class:`gpxtrackposter.track_loader.TrackLoader` object."""
    mock_client_class = mocker.patch("gpxtrackposter.track_loader.Client")
    instance = mock_client_class.return_value
    instance.get_activities.return_value = [
        mock_run_activity, mock_walk_activity, mock_hike_activity
    ]
    return TrackLoader(workers=None)