<s> from sahara . service . validations import images as im <EOL> from sahara . tests . unit . service . validation import utils as u <EOL> class TestTagsAddingValidation ( u . ValidationTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestTagsAddingValidation , self ) . setUp ( ) <EOL> self . _create_object_fun = im . check_tags <EOL> self . scheme = im . image_tags_schema <EOL> def test_add_tags_validation ( self ) : <EOL> right_tags = [ '<STR_LIT:1>' , '<STR_LIT:a>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> wrong_tags = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> wrong_symbols = "<STR_LIT>" <EOL> data = { <EOL> '<STR_LIT>' : [ ] <EOL> } <EOL> for tag in right_tags : <EOL> data [ "<STR_LIT>" ] = [ tag ] <EOL> self . _assert_create_object_validation ( <EOL> data = data ) <EOL> for tag in wrong_tags : <EOL> data [ "<STR_LIT>" ] = [ tag ] <EOL> self . _assert_create_object_validation ( <EOL> data = data , <EOL> bad_req_i = ( <NUM_LIT:1> , '<STR_LIT>' , <EOL> u"<STR_LIT>" % tag ) ) <EOL> for symb in wrong_symbols : <EOL> tag = "<STR_LIT>" % symb <EOL> data [ '<STR_LIT>' ] = [ tag ] <EOL> self . _assert_create_object_validation ( <EOL> data = data , <EOL> bad_req_i = ( <NUM_LIT:1> , '<STR_LIT>' , <EOL> u"<STR_LIT>" % tag ) ) </s>
