def test_login
params = [
{
'from' => 'admin',
'recipient' => '',
'message' => ''
},
{
'from' => 'valcker',
'recipient' => '',
'message' => ''
},
{
'from' => "asdf'asf._--;,dad09354",
'recipient' => '',
'message' => ''
},
{
'from' => 'valcker',
'recipient' => 'lja.,m345"asdfm--__;;',
'message' => 'lja.,m345"asdfm--__;;'
}
]
msg 'Testing login'
params.each do |param|
puts "Params: "
p param
ajaxIM = AjaxIM.new(@db, param['from'], param['recipient'], param['message'])
next if ajaxIM.user.nil?
responce = ajaxIM.login
puts "Got responce from server: #{responce}"
responce = JSON.parse responce
assert_kind_of(Hash, responce, "Responce must be hash")
assert(responce.has_key?('buddy'), "Responce hash doesn't have 'buddy' key")
assert_kind_of(Hash, responce['buddy'], 'Buddy must be hash')
end
end