You've already forked bthlabs-jsonrpc
v1.1.0b1
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# type: ignore
|
||||
from unittest import mock
|
||||
|
||||
from bthlabs_jsonrpc_core import exceptions
|
||||
from django.test import RequestFactory
|
||||
import pytest
|
||||
|
||||
from bthlabs_jsonrpc_django import executor
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_can_call():
|
||||
def fake_can_call() -> mock.Mock:
|
||||
return mock.Mock()
|
||||
|
||||
|
||||
def test_init(rf, fake_can_call):
|
||||
def test_init(rf: RequestFactory, fake_can_call: mock.Mock):
|
||||
# Given
|
||||
request = rf.get('/')
|
||||
|
||||
@@ -24,7 +26,7 @@ def test_init(rf, fake_can_call):
|
||||
assert result.can_call == fake_can_call
|
||||
|
||||
|
||||
def test_enrich_args(rf, fake_can_call):
|
||||
def test_enrich_args(rf: RequestFactory, fake_can_call: mock.Mock):
|
||||
# Given
|
||||
request = rf.get('/')
|
||||
|
||||
@@ -37,7 +39,7 @@ def test_enrich_args(rf, fake_can_call):
|
||||
assert result == [request, 'spam']
|
||||
|
||||
|
||||
def test_before_call(rf, fake_can_call):
|
||||
def test_before_call(rf: RequestFactory, fake_can_call: mock.Mock):
|
||||
# Given
|
||||
request = rf.get('/')
|
||||
|
||||
@@ -50,7 +52,8 @@ def test_before_call(rf, fake_can_call):
|
||||
fake_can_call.assert_called_with(request, 'test', ['spam'], {'spam': True})
|
||||
|
||||
|
||||
def test_before_call_access_denied(rf, fake_can_call):
|
||||
def test_before_call_access_denied(rf: RequestFactory,
|
||||
fake_can_call: mock.Mock):
|
||||
# Given
|
||||
fake_can_call.return_value = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user