-
Notifications
You must be signed in to change notification settings - Fork 216
Add support for stamps #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -550,6 +550,37 @@ def test_backend__task_result_meta_injection(self): | |
tr = TaskResult.objects.get(task_id=tid2) | ||
assert json.loads(tr.meta) == {'key': 'value', 'children': []} | ||
|
||
@pytest.mark.skip("Need to find how to inject stamped headers") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmmm.... not sure if we should merge this with this test only.... should we wait bit more? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree this needs testing - I just couldn't work out how to actually go about setting the stamp on the request |
||
def test_backend__task_result_stamped(self): | ||
self.app.conf.result_serializer = 'json' | ||
self.app.conf.accept_content = {'pickle', 'json'} | ||
self.b = DatabaseBackend(app=self.app) | ||
|
||
tid2 = uuid() | ||
|
||
request = self._create_request( | ||
task_id=tid2, | ||
name='my_task', | ||
args=[], | ||
kwargs={}, | ||
task_protocol=1, | ||
) | ||
result = None | ||
|
||
self.b.mark_as_done(tid2, result, request=request) | ||
mindb = self.b.get_task_meta(tid2) | ||
|
||
# check task meta | ||
assert mindb.get('result') is None | ||
assert mindb.get('task_name') == 'my_task' | ||
|
||
tr = TaskResult.objects.get(task_id=tid2) | ||
assert json.loads(tr.meta) == { | ||
"stamped_headers": ["stamp", "cust_stamp"], | ||
"stamp": "value1", "cust_stamp": "value2", | ||
"children": [] | ||
} | ||
|
||
def test_backend__task_result_date(self): | ||
tid2 = uuid() | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.