<s> import unittest <EOL> import string <EOL> import random <EOL> import os <EOL> from Crypto . PublicKey import RSA <EOL> from unittest . case import SkipTest <EOL> from sneakers . encoders . rsa import Rsa <EOL> import sneakers <EOL> basePath = os . path . dirname ( os . path . abspath ( sneakers . __file__ ) ) <EOL> class TestRsa ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . randText = '<STR_LIT>' . join ( [ random . choice ( string . letters ) for i in range ( <NUM_LIT:10> ) ] ) <EOL> pubPath = os . path . join ( basePath , '<STR_LIT>' , '<STR_LIT>' ) <EOL> privPath = os . path . join ( basePath , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not os . path . isfile ( pubPath ) or not os . path . isfile ( privPath ) : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> self . rsa = Rsa ( ) <EOL> self . rsa . params [ '<STR_LIT>' ] [ '<STR_LIT>' ] = pubPath <EOL> self . rsa . params [ '<STR_LIT>' ] [ '<STR_LIT>' ] = privPath <EOL> def test_encode ( self ) : <EOL> encoded = self . rsa . encode ( self . randText ) <EOL> decoded = self . rsa . decode ( encoded ) <EOL> self . assertEqual ( decoded , self . randText ) </s>
