require 'api' require 'uuid' def swap_option_to(list) if list == 'user' opt[:user] = true opt[:app] = false else opt[:user] = false opt[:app] = true end end def parameter_for(object_type) if object_type == 'app' { object: {api_key: 'an api_key'}, option: {user: false,app: true} } else {object: {login: 'a login',password: 'a password'}, option: {user: true,app: false} } end end def create_object_for(object_type) nb = rand(1000) api_key = UUID.generate if object_type == 'app' {object: {model_name: 'Application',content: {name: 'Axolot'+nb.to_s,api_key: api_key,url: 'http://www.wikimina'+nb.to_s+'.net',user_id: 3 }}} else {object: {model_name: 'User',content: {login: 'nana'+nb.to_s,password: 'passeraa',firstname: 'Ndeye Fatou', lastname: 'Dieng',email: 'nana'+nb.to_s+'@gmail.com',gender: 'M'}} } end end def bad_parameter_for(object_type) if object_type == 'user' {object: {login: 'not a login',password: 'not a password'}, option: {user: true,app: false} } else {object: {api_key: 'not an api_key'}, option: {user: false,app: true} } end end