Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_make_context_single_header(trace_context, other_trace_context):
headers = make_single_header(trace_context)
context = make_context(headers)
assert trace_context == context
headers = make_single_header(other_trace_context)
context = make_context(headers)
assert other_trace_context == context
headers = {'b3': '0'}
context = make_context(headers)
assert context is None
headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
context = make_context(headers)
assert context is None
def test_make_single_header(trace_context, other_trace_context):
headers = make_single_header(trace_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
headers2 = trace_context.make_single_header()
assert headers == expected == headers2
headers = make_single_header(other_trace_context)
h = '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90'
headers2 = other_trace_context.make_single_header()
expected = {'b3': h}
assert headers == expected == headers2
new_context = trace_context._replace(debug=True, sampled=None)
headers = make_single_header(new_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
assert headers == expected
def test_make_single_header(trace_context, other_trace_context):
headers = make_single_header(trace_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
headers2 = trace_context.make_single_header()
assert headers == expected == headers2
headers = make_single_header(other_trace_context)
h = '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90'
headers2 = other_trace_context.make_single_header()
expected = {'b3': h}
assert headers == expected == headers2
new_context = trace_context._replace(debug=True, sampled=None)
headers = make_single_header(new_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
assert headers == expected
def test_make_context_single_header(trace_context, other_trace_context):
headers = make_single_header(trace_context)
context = make_context(headers)
assert trace_context == context
headers = make_single_header(other_trace_context)
context = make_context(headers)
assert other_trace_context == context
headers = {'b3': '0'}
context = make_context(headers)
assert context is None
headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
context = make_context(headers)
assert context is None
def test_make_single_header(trace_context, other_trace_context):
headers = make_single_header(trace_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
headers2 = trace_context.make_single_header()
assert headers == expected == headers2
headers = make_single_header(other_trace_context)
h = '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90'
headers2 = other_trace_context.make_single_header()
expected = {'b3': h}
assert headers == expected == headers2
new_context = trace_context._replace(debug=True, sampled=None)
headers = make_single_header(new_context)
expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
assert headers == expected