#NEWLINE# def test_upload_to( ) : #NEWLINE# #INDENT# fake_instance = FakeModel ( ) #NEWLINE# upload_to = model_helpers . UploadTo ( max_filename_length = 10 ) #NEWLINE# year = date . today ( ) . year #NEWLINE# tools . assert_equal ( upload_to ( fake_instance , '/tmp/filezx/myfile.png' ) , ( 'FakeModel/%d/myfile-1.png' % year ) ) #NEWLINE# tools . assert_equal ( upload_to ( fake_instance , '/tmp/filezx/1234567890123456.png' ) , ( 'FakeModel/%d/1234567890-1.png' % year ) ) #NEWLINE# tools . assert_raises ( ValueError , upload_to , fake_instance , '/tmp/filezx/1234567890123456.php' ) #NEWLINE# tools . assert_raises ( ValueError , upload_to , fake_instance , '/tmp/filezx/1234567890123456.pHp' ) #NEWLINE# tools . assert_raises ( ValueError , upload_to , fake_instance , '/tmp/filezx/.pHp' ) #NEWLINE# tools . assert_equal ( model_helpers . upload_to ( fake_instance , '/tmp/filezx/myfile.png' ) , ( 'FakeModel/%d/myfile-1.png' % year ) )