Exemple #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)
Exemple #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
Exemple #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
Exemple #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)
Exemple #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)
Exemple #6
0
    def _get_args(self):
        args = common_utils.translate_to_str(request.args)

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

        return args