Skip to content

Commit

Permalink
add: tests to verify result_extended flag works
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitPhulera committed May 26, 2022
1 parent 6974a76 commit 7edbd42
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions t/unit/backends/test_database.py
Expand Up @@ -860,3 +860,30 @@ def test_groupresult_save_restore_nested(self):
restored_group = self.b.restore_group(group_id=group_id)

assert restored_group == group

def test_backend_result_extended_is_false(self):
self.app.conf.result_extended = False
self.b = DatabaseBackend(app=self.app)
tid2 = uuid()
request = self._create_request(
task_id=tid2,
name='my_task',
args=['a', 1, True],
kwargs={'c': 6, 'd': 'e', 'f': False},
)
result = 'foo'

self.b.mark_as_done(tid2, result, request=request)

mindb = self.b.get_task_meta(tid2)

# check meta data
assert mindb.get('result') == 'foo'
assert mindb.get('task_name') is None
assert mindb.get('task_args') is None
assert mindb.get('task_kwargs') is None

# check task_result object
tr = TaskResult.objects.get(task_id=tid2)
assert tr.task_args is None
assert tr.task_kwargs is None

0 comments on commit 7edbd42

Please sign in to comment.