"""Collection of tests to ensure correct implementation and track progress of the get_landmarks_nearby feature. """

from fastapi.testclient import TestClient
import pytest

from ..main import app


@pytest.fixture(scope="module")
def client():
    """Client used to call the app."""
    return TestClient(app)


@pytest.mark.parametrize(
    "location,status_code",
    [
        ([45.7576485, 4.8330241], 200),    # Lyon, France
        ([41.4020572, 2.1818985], 200),    # Barcelona, Spain
        ([59.3293, 18.0686], 200),         # Stockholm, Sweden
        ([43.6532, -79.3832], 200),        # Toronto, Canada
        ([38.7223, -9.1393], 200),         # Lisbon, Portugal
        ([6.5244, 3.3792], 200),           # Lagos, Nigeria
        ([17.3850, 78.4867], 200),         # Hyderabad, India
        ([30.0444, 31.2357], 200),         # Cairo, Egypt
        ([50.8503, 4.3517], 200),          # Brussels, Belgium
        ([35.2271, -80.8431], 200),        # Charlotte, USA
        ([10.4806, -66.9036], 200),        # Caracas, Venezuela
        ([9.51074, -13.71118], 200),       # Conakry, Guinea
    ]
)
def test_nearby(client, location, status_code):    # pylint: disable=redefined-outer-name
    """
    Test n°1 : Verify handling of invalid input.

    Args:
        client:
        request:
    """
    response = client.post(f"/get-nearby/landmarks/{location[0]}/{location[1]}")
    suggestions = response.json()

    # checks :
    assert response.status_code == status_code  # check for successful planning
    assert isinstance(suggestions, list)  # check that the return type is a list
    assert len(suggestions) > 0
