implement osusers.tests.test_admin.TaskResultInlineTest
This commit is contained in:
parent
a95c5044bd
commit
773dbea0fe
1 changed files with 31 additions and 0 deletions
31
gnuviechadmin/osusers/tests/test_admin.py
Normal file
31
gnuviechadmin/osusers/tests/test_admin.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
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'))
|
||||||
|
)
|
Loading…
Reference in a new issue