Skip to content

Instantly share code, notes, and snippets.

@Bahus
Last active May 16, 2022 18:46
Show Gist options
  • Save Bahus/4a596832333544439e33054a970fbdb8 to your computer and use it in GitHub Desktop.
Save Bahus/4a596832333544439e33054a970fbdb8 to your computer and use it in GitHub Desktop.
from http import HTTPStatus
import pytest
def browser_client(request):
user_name = request.param
credentials = get_credentials_for_user(user_name)
client = Client()
client.login(**credentials)
client.user = user_name
return client
@pytest.mark.parametrize(
'browser_client, expected_status_code',
[
('admin', HTTPStatus.OK),
('manager', HTTPStatus.FORBIDDEN),
],
indirect=['browser_client'],
)
def test_url_access(browser_client, expected_status_code):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment