32 lines
940 B
Python
32 lines
940 B
Python
|
from django.test import TestCase
|
||
|
from django.contrib.admin import AdminSite
|
||
|
|
||
|
from mock import patch, Mock
|
||
|
|
||
|
from osusers.models import (
|
||
|
User,
|
||
|
)
|
||
|
from osusers.admin import (
|
||
|
UserTaskResultInline,
|
||
|
)
|
||
|
|
||
|
|
||
|
class TaskResultInlineTest(TestCase):
|
||
|
def setUp(self):
|
||
|
self.site = AdminSite()
|
||
|
super(TaskResultInlineTest, self).setUp()
|
||
|
|
||
|
def test_get_queryset_calls_update_taskstatus(self):
|
||
|
with patch('osusers.admin.admin.TabularInline.get_queryset') as mock:
|
||
|
entrymock = Mock(name='entry')
|
||
|
mock.return_value = [entrymock]
|
||
|
requestmock = Mock(name='request')
|
||
|
UserTaskResultInline(User, self.site).get_queryset(requestmock)
|
||
|
entrymock.assert_calledwith()
|
||
|
|
||
|
def test_has_add_permissions_returns_false(self):
|
||
|
self.assertFalse(
|
||
|
UserTaskResultInline(User, self.site).has_add_permission(
|
||
|
self, Mock(name='request'))
|
||
|
)
|