id_user=run_sql("SELECT id FROM user WHERE email=%s",(self.a_email,))[0][0]
self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s",(self.a_nickname,id_user,method_name)),"Can't find id %s for user %s with metod %s. userEXT contains: %s"%(self.a_nickname,id_user,method_name,run_sql("SELECT * FROM userEXT")))
id_user2=run_sql("SELECT id FROM user WHERE email=%s",(self.another_email,))[0][0]
self.failIfEqual(id_user,id_user2)
self.failUnless(run_sql("SELECT * FROM userEXT WHERE id=%s AND id_user=%s AND method=%s",(self.another_nickname,id_user2,method_name)),"Can't find id %s for user %s with metod %s. userEXT contains: %s"%(self.another_nickname,id_user2,method_name,run_sql("SELECT * FROM userEXT")))
## The first email should still exists
self.failUnless(run_sql("SELECT * FROM user WHERE email=%s",(self.a_email,)))
## We log in with the 1st email but with the second nickname.
## That means the 1st user should be merged into the second.
self.failIf(run_sql("SELECT * FROM user WHERE email=%s",(self.another_email,)),"%s still exists! while it should have been merged into %s: %s, userEXT contains: %s"%(self.another_email,self.a_email,run_sql("SELECT * FROM user WHERE email=%s",(self.another_email,)),run_sql("SELECT * FROM userEXT")))
## And the corresponding user should not exist anymore as it has been
## merged into id_user
self.failIf(run_sql("SELECT * FROM user WHERE id=%s",(id_user2,)))
self.failUnless(run_sql("SELECT * FROM user WHERE id=%s AND email=%s",(id_user,self.a_email)))