<s> from logbook import Logger <EOL> from onitu . referee . folder import Folder <EOL> def test_init_size ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> assert f . _to_bytes ( <NUM_LIT:10> ) == <NUM_LIT:10> <EOL> assert f . _to_bytes ( <NUM_LIT> ) == <NUM_LIT:15> <EOL> assert f . _to_bytes ( <NUM_LIT:0> ) == <NUM_LIT:0> <EOL> assert f . _to_bytes ( None ) is None <EOL> assert f . _to_bytes ( '<STR_LIT>' ) is None <EOL> assert f . _to_bytes ( '<STR_LIT>' ) is None <EOL> assert f . _to_bytes ( '<STR_LIT>' ) is None <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT:10> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT:10> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT:10> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT:10> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> assert f . _to_bytes ( '<STR_LIT>' ) == <NUM_LIT> <EOL> def test_no_size ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : val , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( <NUM_LIT:0> ) is True <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> def test_min_size ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT> } } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : val , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( <NUM_LIT:0> ) is False <EOL> assert do_test ( <NUM_LIT> ) is False <EOL> assert do_test ( <NUM_LIT> ) is False <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> def test_max_size ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT> } } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : val , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( <NUM_LIT:0> ) is True <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> assert do_test ( <NUM_LIT> ) is False <EOL> def test_min_and_max_size ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:100> , '<STR_LIT>' : <NUM_LIT:200> } } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : val , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( <NUM_LIT:0> ) is False <EOL> assert do_test ( <NUM_LIT> ) is False <EOL> assert do_test ( <NUM_LIT> ) is True <EOL> assert do_test ( <NUM_LIT> ) is False <EOL> def test_no_mimetype ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : val } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT:application/json>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> def test_mimetypes ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : [ '<STR_LIT:application/json>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] } , <EOL> { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : val } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT:application/json>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' <EOL> '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> def test_no_blacklist ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { } , <EOL> { '<STR_LIT:filename>' : val , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> def test_blacklist ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] } , <EOL> { '<STR_LIT:filename>' : val , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> def test_no_whitelist ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { } , <EOL> { '<STR_LIT:filename>' : val , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> def test_whitelist ( ) : <EOL> f = Folder ( '<STR_LIT>' , { } , Logger ( ) , { } ) <EOL> def do_test ( val ) : <EOL> return f . assert_options ( <EOL> { '<STR_LIT>' : [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] } , <EOL> { '<STR_LIT:filename>' : val , '<STR_LIT:size>' : <NUM_LIT:0> , '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' ) <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is True <EOL> assert do_test ( '<STR_LIT>' ) is False </s>
