1
0
bthlabs-jsonrpc/packages/bthlabs-jsonrpc-django/tests/auth_checks/test_is_staff.py
Tomek Wójcik c75ea4ea9d Initial public releases
* `bthlabs-jsonrpc-aiohttp` v1.0.0
* `bthlabs-jsonrpc-core` v1.0.0
* `bthlabs-jsonrpc-django` v1.0.0
2022-06-04 10:41:53 +02:00

27 lines
472 B
Python

# -*- coding: utf-8 -*-
from bthlabs_jsonrpc_django import auth_checks
def test_is_staff_regular_user(rf, user):
# Given
request = rf.get('/')
request.user = user
# When
result = auth_checks.is_staff(request)
# Then
assert result is False
def test_is_staff_ok(rf, staff_user):
# Given
request = rf.get('/')
request.user = staff_user
# When
result = auth_checks.is_staff(request)
# Then
assert result is True