implement osusers.tests.test_admin.TaskResultInlineTest

This commit is contained in:
Jan Dittberner 2014-06-01 22:01:04 +02:00
parent a95c5044bd
commit 773dbea0fe

View 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'))
)