Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
5.8 kB
1
Indexable
Never
platform darwin -- Python 3.11.4, pytest-7.3.2, pluggy-1.0.0
rootdir: /Users/ijaric/Developer/MidPython/Auth_sprint_1/tests/functional
configfile: pytest.ini
plugins: asyncio-0.12.0, trio-0.8.0, anyio-3.7.0
collected 117 items                                                                                       

src/test_permissions.py ................                                                            [ 13%]
src/test_role_permissions.py F.......                                                               [ 20%]
src/test_roles.py .................................                                                 [ 48%]
src/test_tokens.py .........                                                                        [ 56%]
src/test_user_role_.py F.......                                                                     [ 63%]
src/test_users.py ...........................................                                       [100%]

================================================ FAILURES =================================================
_______________________________________ test_get_role_permissioins ________________________________________

get_permissions_by_role = <function get_permissions_by_role.<locals>._get_permissions_by_role at 0x10549c0e0>
make_request = <function make_request.<locals>.inner at 0x10549d300>
get_test_data = {'permissions': [<models.permission.Permission object at 0x105456150>, <models.permission.Permission object at 0x10545...at 0x105459dd0>, <models.user.UserRole object at 0x105459f10>, <models.user.UserRole object at 0x10545a090>, ...], ...}

    @pytest.mark.asyncio
    async def test_get_role_permissioins(
        get_permissions_by_role, make_request, get_test_data
    ):
        """Тестирование получения списка пермишеннов роли."""
        role_id = get_test_data["roles"][0].id
        permissions = await get_permissions_by_role(role_id)
    
        response = await make_request("GET", f"/roles/{role_id}/permissions")
    
        assert response.status == HTTPStatus.OK
        content = orjson.loads(response.data)
        assert len(content) == len(permissions)
>       assert content[0] == {"id": str(permissions[0].id), "name": permissions[0].name}
E       AssertionError: assert {'id': '77760...e_permission'} == {'id': '77760... 'yayKsoelQm'}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {'name': 'update_permission'} != {'name': 'yayKsoelQm'}
E         Use -v to get more diff

src/test_role_permissions.py:39: AssertionError
------------------------------------------ Captured stderr call -------------------------------------------
2023-06-30 23:12:50,625 - root - INFO - RESPONSE: <urllib3.response.HTTPResponse object at 0x105471990>; URL: http://localhost:8000/api/v1/roles/6c93aaaf-e3c3-43ad-a0df-6cc555f8c7ca/permissions; PARAMS: {}
-------------------------------------------- Captured log call --------------------------------------------
INFO     root:http_client.py:42 RESPONSE: <urllib3.response.HTTPResponse object at 0x105471990>; URL: http://localhost:8000/api/v1/roles/6c93aaaf-e3c3-43ad-a0df-6cc555f8c7ca/permissions; PARAMS: {}
___________________________________________ test_get_user_role ____________________________________________

get_roles_by_user = <function get_roles_by_user.<locals>._get_roles_by_user at 0x10553a660>
make_request = <function make_request.<locals>.inner at 0x10553a840>
get_test_data = {'permissions': [<models.permission.Permission object at 0x105456150>, <models.permission.Permission object at 0x10545...at 0x105459dd0>, <models.user.UserRole object at 0x105459f10>, <models.user.UserRole object at 0x10545a090>, ...], ...}

    @pytest.mark.asyncio
    async def test_get_user_role(get_roles_by_user, make_request, get_test_data):
        """Тестирование получения списка ролей юзера."""
        user_id = get_test_data["users"][0].id
        roles = await get_roles_by_user(user_id)
    
        response = await make_request("GET", f"/users/{user_id}/roles")
    
        assert response.status == HTTPStatus.OK
        content = orjson.loads(response.data)
        assert len(content) == len(roles)
>       assert content[0] == {"id": str(roles[0].id), "name": roles[0].name}
E       AssertionError: assert {'id': '6c93a...: 'role_name'} == {'id': '6c93a... 'jfQSuRHmtm'}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {'name': 'role_name'} != {'name': 'jfQSuRHmtm'}
E         Use -v to get more diff

src/test_user_role_.py:37: AssertionError
------------------------------------------ Captured stderr call -------------------------------------------
2023-06-30 23:12:55,628 - root - INFO - RESPONSE: <urllib3.response.HTTPResponse object at 0x105472b60>; URL: http://localhost:8000/api/v1/users/48c9a707-1397-4f22-8d84-81dee5c19683/roles; PARAMS: {}
-------------------------------------------- Captured log call --------------------------------------------
INFO     root:http_client.py:42 RESPONSE: <urllib3.response.HTTPResponse object at 0x105472b60>; URL: http://localhost:8000/api/v1/users/48c9a707-1397-4f22-8d84-81dee5c19683/roles; PARAMS: {}
========================================= short test summary info =========================================
FAILED src/test_role_permissions.py::test_get_role_permissioins - AssertionError: assert {'id': '77760...e_permission'} == {'id': '77760... 'yayKsoelQm'}
FAILED src/test_user_role_.py::test_get_user_role - AssertionError: assert {'id': '6c93a...: 'role_name'} == {'id': '6c93a... 'jfQSuRHmtm'}
===================================== 2 failed, 115 passed in 11.94s ======================================