def test_translate_to_str_dict_list_unicode(self): input_str = { u'hello': {u'hello': [u'world']} } output_str = utils.translate_to_str(input_str) result = { 'hello': {'hello': ['world']} } self.assertEqual(result, output_str)
def _post_args(self): data = request.json if request.json else {} params = common_utils.translate_to_str(data) action = params.get('action', request.form.get('action', '')) args = params.get('args', {}) try: args['file'] = request.files['file'] except KeyError: pass args.update({k: v for k, v in request.form.items()}) return action, args
def test_translate_to_str_non_string(self): input_value = object() result = utils.translate_to_str(input_value) self.assertIs(input_value, result)
def test_translate_to_str_unicode(self): input_str = u'hello' output_str = utils.translate_to_str(input_str) result = 'hello' self.assertEqual(result, output_str)
def _get_args(self): args = common_utils.translate_to_str(request.args) return args