示例#1
0
 def test_build_IOLogRecord_non_ascii_data(self):
     """
     verify that _build_IOLogRecord() checks that ``data`` is ASCII
     """
     with self.assertRaises(CorruptedSessionError) as boom:
         SessionResumeHelper._build_IOLogRecord([0.0, 'stdout', '\uFFFD'])
     self.assertIsInstance(boom.exception.__context__, UnicodeEncodeError)
示例#2
0
 def test_build_IOLogRecord_bad_type_stream_name(self):
     """
     verify that _build_IOLogRecord() checks that ``stream-name``
     is a string
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([0.0, 1])
示例#3
0
 def test_build_IOLogRecord_non_base64_ascii_data(self):
     """
     verify that _build_IOLogRecord() checks that ``data`` is valid base64
     """
     with self.assertRaises(CorruptedSessionError) as boom:
         SessionResumeHelper._build_IOLogRecord([0.0, 'stdout', '==broken'])
     # base64.standard_b64decode() raises binascii.Error
     self.assertIsInstance(boom.exception.__context__, binascii.Error)
示例#4
0
 def test_build_IOLogRecord_values(self):
     """
     verify that _build_IOLogRecord() returns a proper IOLogRecord object
     with all the values in order
     """
     record = SessionResumeHelper._build_IOLogRecord(
         [1.5, 'stderr', 'dGhpcyB3b3Jrcw=='])
     self.assertAlmostEqual(record.delay, 1.5)
     self.assertEqual(record.stream_name, 'stderr')
     self.assertEqual(record.data, b"this works")
示例#5
0
 def test_build_IOLogRecord_missing_data(self):
     """
     verify that _build_IOLogRecord() checks for missing ``data``
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([0.0, 'stdout'])
示例#6
0
 def test_build_IOLogRecord_bad_value_stream_name(self):
     """
     verify that _build_IOLogRecord() checks that ``stream-name`` looks sane
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([0.0, "foo", ""])
示例#7
0
 def test_build_IOLogRecord_missing_stream_name(self):
     """
     verify that _build_IOLogRecord() checks for missing ``stream-name``
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([0.0])
示例#8
0
 def test_build_IOLogRecord_negative_delay(self):
     """
     verify that _build_IOLogRecord() checks for negative ``delay``
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([-1.0, 'stdout', ''])
示例#9
0
 def test_build_IOLogRecord_bad_type_for_delay(self):
     """
     verify that _build_IOLogRecord() checks that ``delay`` is float
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([0, 'stdout', ''])
示例#10
0
 def test_build_IOLogRecord_missing_delay(self):
     """
     verify that _build_IOLogRecord() checks for missing ``delay``
     """
     with self.assertRaises(CorruptedSessionError):
         SessionResumeHelper._build_IOLogRecord([])