예제 #1
0
    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)
예제 #2
0
    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
예제 #3
0
    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
예제 #4
0
 def test_translate_to_str_non_string(self):
     input_value = object()
     result = utils.translate_to_str(input_value)
     self.assertIs(input_value, result)
예제 #5
0
    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)
예제 #6
0
    def _get_args(self):
        args = common_utils.translate_to_str(request.args)

        return args
예제 #7
0
    def _get_args(self):
        args = common_utils.translate_to_str(request.args)

        return args