def test_assemble_key_with_ascii_filename(self): from ..models import Thumbnail user_id = 'dummy_user_id' category = 'dummy_category' filename = 'bitcoin.jpg' key = Thumbnail._assemble_key(user_id, category, filename) self.assertEqual( key, '{}/{}/{}/{}'.format(settings.DEPLOYMENT, user_id, category, filename))
def test_assemble_key_with_unicode_filename(self): from ..models import Thumbnail user_id = 'dummy_user_id' category = 'dummy_category' filename = '比特币.jpg' key = Thumbnail._assemble_key(user_id, category, filename) self.assertEqual( key, u'{}/{}/{}/{}'.format(settings.DEPLOYMENT, user_id, category, filename.decode('utf-8')))