What are 'rf' and 'user_context' parameters and when are they assigned?
import pytest
from rest_framework import status
from rest_framework.reverse import reverse
from request_helper import pytest_request
@pytest.mark.urls(urls='api.urls')
@pytest.mark.django_db
def test_user_name_check_200(rf, users_context):
data = {
'username': 'test_jay_2'
}
url = reverse(viewname="users-check")
response = pytest_request(rf,
method='get',
url=url,
user=None,
data=data)
assert response.status_code == status.HTTP_200_OK
Both are
pytestfixtures (read about fixtures here: About fixtures).rfis defined inpytest-django(reference); aRequestFactoryinstance will be automatically injected for therfargument in test.users_contextis a fixture defined somewhere in your test project; search for something likein project code.