Skip to content

Commit d8ffdaa

Browse files
committedJul 20, 2018
[oauth] Fix build error in tests
1 parent 2293065 commit d8ffdaa

File tree

3 files changed

+24
-45
lines changed

3 files changed

+24
-45
lines changed
 

‎src/auth/oauth2/qgsauthoauth2edit.cpp

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ QString QgsAuthOAuth2Edit::parentConfigId() const
128128
return cie->configId();
129129
}
130130

131-
// slot
131+
132132
void QgsAuthOAuth2Edit::setupConnections()
133133
{
134134
// Action and interaction connections
@@ -186,7 +186,7 @@ void QgsAuthOAuth2Edit::setupConnections()
186186
}
187187
}
188188

189-
// slot
189+
190190
void QgsAuthOAuth2Edit::configValidityChanged()
191191
{
192192
validateConfig();
@@ -471,14 +471,14 @@ void QgsAuthOAuth2Edit::updateTokenCacheFile( bool curpersist ) const
471471
}
472472
}
473473

474-
// slot
474+
475475
void QgsAuthOAuth2Edit::tabIndexChanged( int indx )
476476
{
477477
mCurTab = indx;
478478
validateConfig();
479479
}
480480

481-
// slot
481+
482482
void QgsAuthOAuth2Edit::populateGrantFlows()
483483
{
484484
cmbbxGrantFlow->addItem( QgsAuthOAuth2Config::grantFlowString( QgsAuthOAuth2Config::AuthCode ),
@@ -489,7 +489,7 @@ void QgsAuthOAuth2Edit::populateGrantFlows()
489489
static_cast<int>( QgsAuthOAuth2Config::ResourceOwner ) );
490490
}
491491

492-
// slot
492+
493493
void QgsAuthOAuth2Edit::definedCustomDirChanged( const QString &path )
494494
{
495495
QFileInfo pinfo( path );
@@ -518,7 +518,6 @@ void QgsAuthOAuth2Edit::softwareStatementJwtPathChanged( const QString &path )
518518
}
519519

520520

521-
// slot
522521
void QgsAuthOAuth2Edit::setCurrentDefinedConfig( const QString &id )
523522
{
524523
mDefinedId = id;
@@ -539,7 +538,7 @@ void QgsAuthOAuth2Edit::currentDefinedItemChanged( QListWidgetItem *cur, QListWi
539538
}
540539
}
541540

542-
// slot
541+
543542
void QgsAuthOAuth2Edit::selectCurrentDefinedConfig()
544543
{
545544
if ( mDefinedId.isEmpty() )
@@ -566,7 +565,6 @@ void QgsAuthOAuth2Edit::selectCurrentDefinedConfig()
566565
}
567566
}
568567

569-
// slot
570568
void QgsAuthOAuth2Edit::getDefinedCustomDir()
571569
{
572570
QString extradir = QFileDialog::getExistingDirectory( this, tr( "Select extra directory to parse" ),
@@ -640,15 +638,13 @@ void QgsAuthOAuth2Edit::removeTokenCacheFile()
640638
btnTokenClear->setEnabled( hasTokenCacheFile() );
641639
}
642640

643-
// slot
644641
void QgsAuthOAuth2Edit::updateDefinedConfigsCache()
645642
{
646643
QString extradir = leDefinedDirPath->text();
647644
mDefinedConfigsCache.clear();
648645
mDefinedConfigsCache = QgsAuthOAuth2Config::mappedOAuth2ConfigsCache( this, extradir );
649646
}
650647

651-
// slot
652648
void QgsAuthOAuth2Edit::loadDefinedConfigs()
653649
{
654650
lstwdgDefinedConfigs->blockSignals( true );
@@ -716,7 +712,6 @@ bool QgsAuthOAuth2Edit::onStatementTab() const
716712
return mCurTab == statementTab();
717713
}
718714

719-
// slot
720715
void QgsAuthOAuth2Edit::updateGrantFlow( int indx )
721716
{
722717
if ( cmbbxGrantFlow->currentIndex() != indx )
@@ -761,7 +756,7 @@ void QgsAuthOAuth2Edit::updateGrantFlow( int indx )
761756
lePassword->setText( QString() );
762757
}
763758

764-
// slot
759+
765760
void QgsAuthOAuth2Edit::exportOAuthConfig()
766761
{
767762
if ( !onCustomTab() || !mValid )
@@ -802,7 +797,7 @@ void QgsAuthOAuth2Edit::exportOAuthConfig()
802797
mOAuthConfigCustom->setName( QString::null );
803798
}
804799

805-
// slot
800+
806801
void QgsAuthOAuth2Edit::importOAuthConfig()
807802
{
808803
if ( !onCustomTab() )
@@ -847,13 +842,13 @@ void QgsAuthOAuth2Edit::importOAuthConfig()
847842
loadConfig( configmap );
848843
}
849844

850-
// slot
845+
851846
void QgsAuthOAuth2Edit::descriptionChanged()
852847
{
853848
mOAuthConfigCustom->setDescription( pteDescription->toPlainText() );
854849
}
855850

856-
// slot
851+
857852
void QgsAuthOAuth2Edit::populateAccessMethods()
858853
{
859854
cmbbxAccessMethod->addItem( QgsAuthOAuth2Config::accessMethodString( QgsAuthOAuth2Config::Header ),
@@ -864,7 +859,7 @@ void QgsAuthOAuth2Edit::populateAccessMethods()
864859
static_cast<int>( QgsAuthOAuth2Config::Query ) );
865860
}
866861

867-
// slot
862+
868863
void QgsAuthOAuth2Edit::updateConfigAccessMethod( int indx )
869864
{
870865
mOAuthConfigCustom->setAccessMethod( static_cast<QgsAuthOAuth2Config::AccessMethod>( indx ) );
@@ -887,7 +882,7 @@ void QgsAuthOAuth2Edit::addQueryPairRow( const QString &key, const QString &val
887882
tblwdgQueryPairs->setItem( rowCnt, 1, valItm );
888883
}
889884

890-
// slot
885+
891886
void QgsAuthOAuth2Edit::populateQueryPairs( const QVariantMap &querypairs, bool append )
892887
{
893888
if ( !append )
@@ -903,7 +898,7 @@ void QgsAuthOAuth2Edit::populateQueryPairs( const QVariantMap &querypairs, bool
903898
}
904899
}
905900

906-
// slot
901+
907902
void QgsAuthOAuth2Edit::queryTableSelectionChanged()
908903
{
909904
bool hassel = tblwdgQueryPairs->selectedItems().count() > 0;
@@ -930,7 +925,7 @@ QVariantMap QgsAuthOAuth2Edit::queryPairs() const
930925
return querypairs;
931926
}
932927

933-
// slot
928+
934929
void QgsAuthOAuth2Edit::addQueryPair()
935930
{
936931
addQueryPairRow( QString(), QString() );
@@ -939,13 +934,13 @@ void QgsAuthOAuth2Edit::addQueryPair()
939934
tblwdgQueryPairs->edit( tblwdgQueryPairs->currentIndex() );
940935
}
941936

942-
// slot
937+
943938
void QgsAuthOAuth2Edit::removeQueryPair()
944939
{
945940
tblwdgQueryPairs->removeRow( tblwdgQueryPairs->currentRow() );
946941
}
947942

948-
// slot
943+
949944
void QgsAuthOAuth2Edit::clearQueryPairs()
950945
{
951946
for ( int i = tblwdgQueryPairs->rowCount(); i > 0 ; --i )
@@ -1149,13 +1144,3 @@ void QgsAuthOAuth2Edit::getSoftwareStatementConfig()
11491144
}
11501145
}
11511146

1152-
QString QgsAuthOAuth2Edit::registrationEndpoint() const
1153-
{
1154-
return mRegistrationEndpoint;
1155-
}
1156-
1157-
void QgsAuthOAuth2Edit::setRegistrationEndpoint( const QString &registrationEndpoint )
1158-
{
1159-
mRegistrationEndpoint = registrationEndpoint;
1160-
}
1161-

‎src/auth/oauth2/qgsauthoauth2edit.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ class QgsAuthOAuth2Edit : public QgsAuthMethodEdit, private Ui::QgsAuthOAuth2Edi
126126

127127
void networkError( QNetworkReply::NetworkError error );
128128

129-
//! For testability
130-
QString registrationEndpoint() const;
131-
132-
//! For testability
133-
void setRegistrationEndpoint( const QString &registrationEndpoint );
134-
135129
private:
136130

137131
void initGui();

‎tests/src/auth/testqgsauthoauth2method.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationNoEndpoint()
415415
config->setClientId( QString( ) );
416416
config->setClientSecret( QString( ) );
417417
QVariantMap configMap( config->mappedProperties() );
418-
QCOMPARE( configMap["clientId"], QString() );
419-
QCOMPARE( configMap["clientSecret"], QString() );
418+
QCOMPARE( configMap["clientId"].toString(), QString() );
419+
QCOMPARE( configMap["clientSecret"].toString(), QString() );
420420
QgsAuthOAuth2Edit dlg;
421421
QgsStringMap stringMap;
422422
for ( const auto &k : configMap.keys( ) )
@@ -439,8 +439,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistration()
439439
config->setClientId( QString( ) );
440440
config->setClientSecret( QString( ) );
441441
QVariantMap configMap( config->mappedProperties() );
442-
QCOMPARE( configMap["clientId"], QString() );
443-
QCOMPARE( configMap["clientSecret"], QString() );
442+
QCOMPARE( configMap["clientId"].toString(), QString() );
443+
QCOMPARE( configMap["clientSecret"].toString(), QString() );
444444
QgsAuthOAuth2Edit dlg;
445445
QgsStringMap stringMap;
446446
for ( const auto &k : configMap.keys( ) )
@@ -459,7 +459,7 @@ void TestQgsAuthOAuth2Method::testDynamicRegistration()
459459
dlg.leSoftwareStatementConfigUrl->setText( QUrl::fromLocalFile( QStringLiteral( "%1/auth_code_grant_display_code_get_config.json" ).arg( sTestDataDir ) ).toString( ) );
460460
QVERIFY( dlg.btnRegister->isEnabled() );
461461
// Change it to something local
462-
dlg.setRegistrationEndpoint( QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString() );
462+
dlg.mRegistrationEndpoint = QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString();
463463
QTest::mouseClick( dlg.btnRegister, Qt::MouseButton::LeftButton );
464464
while ( dlg.mDownloading )
465465
{
@@ -476,8 +476,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationJwt()
476476
config->setClientId( QString( ) );
477477
config->setClientSecret( QString( ) );
478478
QVariantMap configMap( config->mappedProperties() );
479-
QCOMPARE( configMap["clientId"], QString() );
480-
QCOMPARE( configMap["clientSecret"], QString() );
479+
QCOMPARE( configMap["clientId"].toString(), QString() );
480+
QCOMPARE( configMap["clientSecret"].toString(), QString() );
481481
QgsAuthOAuth2Edit dlg;
482482
QgsStringMap stringMap;
483483
for ( const auto &k : configMap.keys( ) )
@@ -493,7 +493,7 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationJwt()
493493
QCOMPARE( dlg.leSoftwareStatementConfigUrl->text(), QStringLiteral( "http://www.qgis.org/oauth2/registration" ) );
494494
QVERIFY( dlg.btnRegister->isEnabled() );
495495
// Change it to something local
496-
dlg.setRegistrationEndpoint( QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString() );
496+
dlg.mRegistrationEndpoint = QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString();
497497
QTest::mouseClick( dlg.btnRegister, Qt::MouseButton::LeftButton );
498498
while ( dlg.mDownloading )
499499
{

0 commit comments

Comments
 (0)
Please sign in to comment.