from banbou import controller_projection

def test_projection_correcte_metropole() :
    sut = ("1004", 1585702, 2185080)

    proj = controller_projection(*sut)

    assert proj == "CC43"

def test_projection_correcte_avec_des_flottants() :
    sut = ("1004", 1585702.06, 2185080.612)

    proj = controller_projection(*sut)

    assert proj == "CC43"

def test_lattitude_incorrecte() :
    sut = ("1004", 1000000, 0)

    proj = controller_projection(*sut)

    assert proj == "Mauvaise projection"

def test_longitude_incorrecte(capsys) : 
    sut = ("1004", 1000000, 0)

    proj = controller_projection(*sut)
    out, err = capsys.readouterr()
    expected_out = "Proj. trouvé : Mauvaise projection\n" + "Avertissement : Longitude du point id 1004 pas en métropole.\n"

    assert proj == "Mauvaise projection"
    assert out == expected_out

