Example #1
0
 def test_decode_command_args__ok(self):
     message = Mock()
     message.command_args = 'eyJmb28iOiAiYmFyIn0='
     self.assertEqual(
         Message.decode_command_args(message),
         {"foo": "bar"},
     )
Example #2
0
 def test_decode_command_args__ok(self):
     message = Mock()
     message.command_args = 'eyJmb28iOiAiYmFyIn0='
     self.assertEqual(
         Message.decode_command_args(message),
         {"foo": "bar"},
         )
Example #3
0
 def test_decode_command_args__loading_json_error(self):
     message = Mock()
     message.command_args = 'Ww==' # b'['
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #4
0
 def test_decode_command_args__unicode_decode_error(self):
     message = Mock()
     message.command_args = '_w==' # b'\xff'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #5
0
 def test_decode_command_args__b64decode_value_error(self):
     message = Mock()
     message.command_args = 'кириллица'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #6
0
 def test_decode_command_args__b64decode_incorrect_padding(self):
     message = Mock()
     message.command_args = 'NoonfowfVyZSwg'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #7
0
 def test_decode_command_args__b64decode_type_error(self):
     message = Mock()
     message.command_args = None
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #8
0
 def test_decode_command_args__loading_json_error(self):
     message = Mock()
     message.command_args = 'Ww=='  # b'['
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #9
0
 def test_decode_command_args__unicode_decode_error(self):
     message = Mock()
     message.command_args = '_w=='  # b'\xff'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #10
0
 def test_decode_command_args__b64decode_value_error(self):
     message = Mock()
     message.command_args = 'кириллица'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #11
0
 def test_decode_command_args__b64decode_incorrect_padding(self):
     message = Mock()
     message.command_args = 'NoonfowfVyZSwg'
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)
Example #12
0
 def test_decode_command_args__b64decode_type_error(self):
     message = Mock()
     message.command_args = None
     with self.assertRaises(UnsupportedContentError):
         Message.decode_command_args(message)