예제 #1
0
 def test_content_is_ascii(self):
     response = Response(status_code=200,
                         reason='OK',
                         content=b'3.6 roentgen. Not great. Not terrible.')
     formatted = RepeatRecord._format_response(response)
     self.assertEqual(formatted,
                      '200: OK.\n3.6 roentgen. Not great. Not terrible.')
예제 #2
0
 def test_encoding_is_not_ascii(self):
     response = Response(
         status_code=200,
         reason='OK',
         content=b'3,6 \xe1\xa8\xd4\xe5\xac\xa8\xd4\xa0 \xd5\xa8 \xb5\xd6\xe1\xd6\xf5\xd6. '
                 b'\xd5\xa8 \xe3\xe5\xe1\xa0\xf5\xd4\xd6',
         encoding='cp855'
     )
     formatted = RepeatRecord._format_response(response)
     self.assertEqual(formatted, '200: OK.\n3,6 рентгена Не хорошо. Не страшно')
예제 #3
0
 def test_content_is_None(self):
     response = Response(500, 'The core is exposed')
     formatted = RepeatRecord._format_response(response)
     self.assertEqual(formatted, '500: The core is exposed.\n')