Skip to content

Commit c726838

Browse files
committed
add a test to verify how get_object_actions works
1 parent ca952da commit c726838

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: django_object_actions/tests/test_utils.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ class BaseDjangoObjectActionsTest(TestCase):
1414
def setUp(self):
1515
self.instance = BaseDjangoObjectActions()
1616

17+
def test_get_object_actions_gets_attribute(self):
18+
mock_objectactions = [] # set to something mutable
19+
mock_request = 'request'
20+
mock_context = 'context'
21+
mock_kwargs = {}
22+
self.instance.objectactions = mock_objectactions
23+
returned_value = self.instance.get_object_actions(
24+
mock_request, mock_context, **mock_kwargs
25+
)
26+
# assert that `mock_objectactions` was returned
27+
self.assertEqual(id(mock_objectactions), id(returned_value))
28+
# WISHLIST assert get_object_actions was called with right args
29+
1730
def test_get_djoa_button_attrs_returns_defaults(self):
1831
mock_tool = type('mock_tool', (object, ), {})
1932
attrs, __ = self.instance.get_djoa_button_attrs(mock_tool)
@@ -35,7 +48,6 @@ def test_get_djoa_button_attrs_disallows_title(self):
3548
attrs, __ = self.instance.get_djoa_button_attrs(mock_tool)
3649
self.assertEqual(attrs['title'], 'real title')
3750

38-
3951
def test_get_djoa_button_attrs_gets_set(self):
4052
mock_tool = type('mock_tool', (object, ), {
4153
'attrs': {'class': 'class'},

0 commit comments

Comments
 (0)