27 lines
472 B
Python
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
|