"Fossies" - the Fresh Open Source Software Archive

Member "http-prompt-2.1.0/tests/test_contextio.py" (5 Mar 2021, 706 Bytes) of package /linux/www/http-prompt-2.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- coding: utf-8 -*-
    2 from __future__ import unicode_literals
    3 
    4 from .base import TempAppDirTestCase
    5 from http_prompt.context import Context
    6 from http_prompt.contextio import save_context, load_context
    7 
    8 
    9 class TestContextIO(TempAppDirTestCase):
   10 
   11     def test_save_and_load_context_non_ascii(self):
   12         c = Context('http://localhost')
   13         c.headers.update({
   14             'User-Agent': 'Ö',
   15             'Authorization': '中文'
   16         })
   17         save_context(c)
   18 
   19         c = Context('http://0.0.0.0')
   20         load_context(c)
   21 
   22         self.assertEqual(c.url, 'http://localhost')
   23         self.assertEqual(c.headers, {
   24             'User-Agent': 'Ö',
   25             'Authorization': '中文'
   26         })