@@ -2426,26 +2426,24 @@ void TestMerginApi::testRegisterAndDelete()
24262426 QString password = mApi ->userAuth ()->password ();
24272427
24282428 QString quiteRandom = CoreUtils::uuidWithoutBraces ( QUuid::createUuid () ).right ( 15 ).replace ( " -" , " " );
2429- QString username = " test_" + quiteRandom;
2430- QString email = username + " @nonexistant.email.com" ;
2429+ QString email = " test_" + quiteRandom + " @nonexistant.email.com" ;
24312430
2432- qDebug () << " username :" << username ;
2431+ qDebug () << " email :" << email ;
24332432 // do not want to be authorized
24342433 mApi ->clearAuth ();
24352434
24362435 QSignalSpy spy ( mApi , &MerginApi::registrationSucceeded );
24372436 QSignalSpy spy2 ( mApi , &MerginApi::registrationFailed );
2438- mApi ->registerUser ( username, email, password , password, true );
2437+ mApi ->registerUser ( email, password, true );
24392438 bool success = spy.wait ( TestUtils::LONG_REPLY );
24402439 if ( !success )
24412440 {
24422441 qDebug () << " Failed registration" << spy2.takeFirst ();
24432442 QVERIFY ( false );
24442443 }
24452444
2446-
24472445 QSignalSpy spyAuth ( mApi ->userAuth (), &MerginUserAuth::authChanged );
2448- mApi ->authorize ( username , password );
2446+ mApi ->authorize ( email , password );
24492447 QVERIFY ( spyAuth.wait ( TestUtils::LONG_REPLY * 5 ) );
24502448
24512449 // now delete user
@@ -2466,11 +2464,11 @@ void TestMerginApi::testCreateWorkspace()
24662464 QString password = TestUtils::generatePassword ();
24672465 QString email = TestUtils::generateEmail ();
24682466
2469- qDebug () << " REGISTERING NEW TEST USER:" << username ;
2467+ qDebug () << " REGISTERING NEW TEST USER WITH EMAIL :" << email ;
24702468
24712469 QSignalSpy spy ( mApi , &MerginApi::registrationSucceeded );
24722470 QSignalSpy spy2 ( mApi , &MerginApi::registrationFailed );
2473- mApi ->registerUser ( username, email, password , password, true );
2471+ mApi ->registerUser ( email, password, true );
24742472 bool success = spy.wait ( TestUtils::LONG_REPLY );
24752473 if ( !success )
24762474 {
@@ -2479,7 +2477,7 @@ void TestMerginApi::testCreateWorkspace()
24792477 }
24802478
24812479 QSignalSpy authSpy ( mApi , &MerginApi::authChanged );
2482- mApi ->authorize ( username , password );
2480+ mApi ->authorize ( email , password );
24832481 QVERIFY ( authSpy.wait ( TestUtils::LONG_REPLY ) );
24842482 QVERIFY ( !authSpy.isEmpty () );
24852483
@@ -2854,41 +2852,27 @@ void TestMerginApi::testServerError()
28542852
28552853void TestMerginApi::testRegistration ()
28562854{
2857- QString username = " ?" ;
28582855 QString email = " broken@email" ;
28592856 QString password = " pwd" ;
2860- QString confirm_password = password;
28612857
28622858 // do not want to be authorized
28632859 mApi ->clearAuth ();
28642860
2865- // wrong username test
2866- QSignalSpy spy ( mApi , &MerginApi::registrationFailed );
2867- mApi ->registerUser ( username, email, password, confirm_password, true );
2868- QCOMPARE ( spy.count (), 1 );
2869- QCOMPARE ( spy.takeFirst ().at ( 1 ).toInt (), RegistrationError::RegistrationErrorType::USERNAME );
2870-
28712861 // wrong email test
2872- username = " username " ;
2873- mApi ->registerUser ( username, email, password, confirm_password , true );
2862+ QSignalSpy spy ( mApi , &MerginApi::registrationFailed ) ;
2863+ mApi ->registerUser ( email, password, true );
28742864 QCOMPARE ( spy.count (), 1 );
28752865 QCOMPARE ( spy.takeFirst ().at ( 1 ).toInt (), RegistrationError::RegistrationErrorType::EMAIL );
28762866
28772867 // wrong password test
28782868 email = " username@email.com" ;
2879- mApi ->registerUser ( username, email, password, confirm_password , true );
2869+ mApi ->registerUser ( email, password, true );
28802870 QCOMPARE ( spy.count (), 1 );
28812871 QCOMPARE ( spy.takeFirst ().at ( 1 ).toInt (), RegistrationError::RegistrationErrorType::PASSWORD );
28822872
2883- // wrong confirm password test
2884- password = " Lutra123:)" ;
2885- mApi ->registerUser ( username, email, password, confirm_password, true );
2886- QCOMPARE ( spy.count (), 1 );
2887- QCOMPARE ( spy.takeFirst ().at ( 1 ).toInt (), RegistrationError::RegistrationErrorType::CONFIRM_PASSWORD );
2888-
28892873 // unchecked TOC test
2890- confirm_password = " Lutra123:)" ;
2891- mApi ->registerUser ( username, email, password, confirm_password , false );
2874+ password = " Lutra123:)" ;
2875+ mApi ->registerUser ( email, password, false );
28922876 QCOMPARE ( spy.count (), 1 );
28932877 QCOMPARE ( spy.takeFirst ().at ( 1 ).toInt (), RegistrationError::RegistrationErrorType::TOC );
28942878}
0 commit comments