# Path: rest_framework_tus/utils.py
# def encode_upload_metadata(upload_metadata):
#     """
#     Encodes upload metadata according to the TUS 1.0.0 spec (http://tus.io/protocols/resumable-upload.html#creation)
# 
#     :param dict upload_metadata:
#     :return str:
#     """
#     # Prepare encoded data
#     encoded_data = [(key, encode_base64_to_string(value))
#                     for (key, value) in sorted(upload_metadata.items(), key=lambda item: item[0])]
# 
#     # Encode into string
#     return ','.join([' '.join([key, encoded_value]) for key, encoded_value in encoded_data])
# 
# def encode_base64_to_string(data):
#     """
#     Helper to encode a string or bytes value to a base64 string as bytes
# 
#     :param six.text_types data:
#     :return six.binary_type:
#     """
# 
#     if not isinstance(data, six.binary_type):
#         if isinstance(data, six.text_type):
#             data = data.encode('utf-8')
#         else:
#             data = six.text_type(data).encode('utf-8')
# 
#     return encode_base64(data).decode('ascii').rstrip('\n')
# 
# Path: rest_framework_tus/compat.py



from unittest.case import TestCase
from rest_framework_tus.utils import encode_upload_metadata, encode_base64_to_string
from rest_framework_tus.compat import decode_base64
# -*- coding: utf-8 -*-
from __future__ import unicode_literals




class UtilsTest(TestCase):
    def test_encode_64(self):
        data = b'filename123.jpg'

        # Encode

# Path: rest_framework_tus/utils.py
# def encode_upload_metadata(upload_metadata):
#     """
#     Encodes upload metadata according to the TUS 1.0.0 spec (http://tus.io/protocols/resumable-upload.html#creation)
# 
#     :param dict upload_metadata:
#     :return str:
#     """
#     # Prepare encoded data
#     encoded_data = [(key, encode_base64_to_string(value))
#                     for (key, value) in sorted(upload_metadata.items(), key=lambda item: item[0])]
# 
#     # Encode into string
#     return ','.join([' '.join([key, encoded_value]) for key, encoded_value in encoded_data])
# 
# def encode_base64_to_string(data):
#     """
#     Helper to encode a string or bytes value to a base64 string as bytes
# 
#     :param six.text_types data:
#     :return six.binary_type:
#     """
# 
#     if not isinstance(data, six.binary_type):
#         if isinstance(data, six.text_type):
#             data = data.encode('utf-8')
#         else:
#             data = six.text_type(data).encode('utf-8')
# 
#     return encode_base64(data).decode('ascii').rstrip('\n')
# 
# Path: rest_framework_tus/compat.py



# Path: tests/tests/test_utils.py
from unittest.case import TestCase
from rest_framework_tus.utils import encode_upload_metadata, encode_base64_to_string
from rest_framework_tus.compat import decode_base64

# -*- coding: utf-8 -*-
from __future__ import unicode_literals




class UtilsTest(TestCase):
    def test_encode_64(self):
        data = b'filename123.jpg'

        # Encode

        result = encode_base64_to_string(data)