def test_noop_if_output_key_does_not_exist(self): original = {'foo': 'bar'} parsed = original.copy() handlers.decode_console_output(parsed) # Should be unchanged because the 'Output' # key is not in the output. self.assertEqual(parsed, original)
def test_get_console_output_cant_be_decoded(self): parsed = {'Output': 1} handlers.decode_console_output(parsed) self.assertEqual(parsed['Output'], 1)
def test_get_console_output_bad_unicode_errors(self): original = base64.b64encode(b'before\xffafter').decode('utf-8') parsed = {'Output': original} handlers.decode_console_output(parsed) self.assertEqual(parsed['Output'], u'before\ufffdafter')
def test_get_console_output(self): parsed = {'Output': base64.b64encode(b'foobar').decode('utf-8')} handlers.decode_console_output(parsed) self.assertEqual(parsed['Output'], 'foobar')