Skip to content

Commit

Permalink
adding test file
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic182 committed Nov 21, 2020
1 parent ac551d7 commit 6c7a61e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

from aiosonic import HttpHeaders


def test_headers_retrival():
"""Test reading header with more than one ":" char ocurrence."""
sample_header = b'Report-To: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }\r\n'
assert len(HttpHeaders._clear_line(sample_header)) == 2


def test_headers_retrival_common():
"""Test reading header with more than one ":" char ocurrence."""
res = [b'Authorization', b'Bearer foobar']
sample_header = b': '.join(res) + b'\r\n'
assert HttpHeaders._clear_line(sample_header) == res

0 comments on commit 6c7a61e

Please sign in to comment.