<s> import pytest <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , ( <EOL> ( '<STR_LIT>' , ) , <EOL> ( '<STR_LIT>' , ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , ) , <EOL> ) ) <EOL> def test_getting_list_of_users_by_unauthorized_user_must_fail ( <EOL> flask_app_client , <EOL> regular_user , <EOL> auth_scopes <EOL> ) : <EOL> with flask_app_client . login ( regular_user , auth_scopes = auth_scopes ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in auth_scopes : <EOL> assert response . status_code == <NUM_LIT> <EOL> else : <EOL> assert response . status_code == <NUM_LIT> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert set ( response . json . keys ( ) ) >= { '<STR_LIT:status>' , '<STR_LIT:message>' } <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , ( <EOL> ( '<STR_LIT>' , ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , ) , <EOL> ) ) <EOL> def test_getting_list_of_users_by_authorized_user ( flask_app_client , admin_user , auth_scopes ) : <EOL> with flask_app_client . login ( admin_user , auth_scopes = auth_scopes ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert isinstance ( response . json , list ) <EOL> assert set ( response . json [ <NUM_LIT:0> ] . keys ( ) ) >= { '<STR_LIT:id>' , '<STR_LIT:username>' } <EOL> def test_getting_user_info_by_unauthorized_user ( flask_app_client , regular_user , admin_user ) : <EOL> with flask_app_client . login ( regular_user , auth_scopes = ( '<STR_LIT>' , ) ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' % admin_user . id ) <EOL> assert response . status_code == <NUM_LIT> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert isinstance ( response . json , dict ) <EOL> assert set ( response . json . keys ( ) ) >= { '<STR_LIT:status>' , '<STR_LIT:message>' } <EOL> def test_getting_user_info_by_authorized_user ( flask_app_client , regular_user , admin_user ) : <EOL> with flask_app_client . login ( admin_user , auth_scopes = ( '<STR_LIT>' , ) ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' % regular_user . id ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert isinstance ( response . json , dict ) <EOL> assert set ( response . json . keys ( ) ) >= { '<STR_LIT:id>' , '<STR_LIT:username>' } <EOL> assert '<STR_LIT:password>' not in response . json . keys ( ) <EOL> def test_getting_user_info_by_owner ( flask_app_client , regular_user ) : <EOL> with flask_app_client . login ( regular_user , auth_scopes = ( '<STR_LIT>' , ) ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' % regular_user . id ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert isinstance ( response . json , dict ) <EOL> assert set ( response . json . keys ( ) ) >= { '<STR_LIT:id>' , '<STR_LIT:username>' } <EOL> assert '<STR_LIT:password>' not in response . json . keys ( ) <EOL> def test_getting_user_me_info ( flask_app_client , regular_user ) : <EOL> with flask_app_client . login ( regular_user , auth_scopes = ( '<STR_LIT>' , ) ) : <EOL> response = flask_app_client . get ( '<STR_LIT>' ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert response . content_type == '<STR_LIT:application/json>' <EOL> assert isinstance ( response . json , dict ) <EOL> assert set ( response . json . keys ( ) ) >= { '<STR_LIT:id>' , '<STR_LIT:username>' } <EOL> assert '<STR_LIT:password>' not in response . json . keys ( ) </s>
