Skip to content
Snippets Groups Projects
Select Git revision
  • 3be48211ad062297750f9e103c46f63d4f7ab1f3
  • main default protected
  • variant
3 results

ElementGenerator.java

Blame
  • Forked from COUETOUX Basile / FirefighterStarter
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_index.py 2.10 KiB
    # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Vigenere-API                                                                        +
    #  Copyright (C) 2023 Axel DAVID                                                       +
    #                                                                                      +
    #  This program is free software: you can redistribute it and/or modify it under       +
    #  the terms of the GNU General Public License as published by the Free Software       +
    #  Foundation, either version 3 of the License, or (at your option) any later version. +
    #                                                                                      +
    #  This program is distributed in the hope that it will be useful, but WITHOUT ANY     +
    #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR       +
    #  A PARTICULAR PURPOSE. See the GNU General Public License for more details.          +
    #                                                                                      +
    #  You should have received a copy of the GNU General Public License along with        +
    #  this program.  If not, see <https://www.gnu.org/licenses/>.                         +
    # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
    import pytest
    from blacksheep.testing import TestClient
    
    
    @pytest.mark.asyncio()
    async def test_get_index(test_client: TestClient) -> None:
        response = await test_client.get("/")
    
        assert response is not None
    
        assert response.status == 302
        assert response.content is None
        assert response.reason.upper() == "FOUND"
    
        first_header = response.headers.values[0]
        assert first_header[0] == b"Location"
        assert first_header[1] == b"/api/v1"
    
    
    @pytest.mark.asyncio()
    async def test_bad_path(test_client: TestClient) -> None:
        response = await test_client.get("/zzzzzzzzzz")
    
        assert response is not None
    
        assert response.status == 200
        assert response.content is not None
        assert response.reason.upper() == "OK"
    
        assert await response.text() == "OOPS! Nothing was found here!"