Skip to content
Permalink
Browse files

[oauth] Fix build error in tests

  • Loading branch information
elpaso committed Jul 20, 2018
1 parent 2293065 commit d8ffdaa3af1f6b01951e1ab6e9409deb4cf5f1f1
@@ -128,7 +128,7 @@ QString QgsAuthOAuth2Edit::parentConfigId() const
return cie->configId();
}

// slot

void QgsAuthOAuth2Edit::setupConnections()
{
// Action and interaction connections
@@ -186,7 +186,7 @@ void QgsAuthOAuth2Edit::setupConnections()
}
}

// slot

void QgsAuthOAuth2Edit::configValidityChanged()
{
validateConfig();
@@ -471,14 +471,14 @@ void QgsAuthOAuth2Edit::updateTokenCacheFile( bool curpersist ) const
}
}

// slot

void QgsAuthOAuth2Edit::tabIndexChanged( int indx )
{
mCurTab = indx;
validateConfig();
}

// slot

void QgsAuthOAuth2Edit::populateGrantFlows()
{
cmbbxGrantFlow->addItem( QgsAuthOAuth2Config::grantFlowString( QgsAuthOAuth2Config::AuthCode ),
@@ -489,7 +489,7 @@ void QgsAuthOAuth2Edit::populateGrantFlows()
static_cast<int>( QgsAuthOAuth2Config::ResourceOwner ) );
}

// slot

void QgsAuthOAuth2Edit::definedCustomDirChanged( const QString &path )
{
QFileInfo pinfo( path );
@@ -518,7 +518,6 @@ void QgsAuthOAuth2Edit::softwareStatementJwtPathChanged( const QString &path )
}


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

// slot

void QgsAuthOAuth2Edit::selectCurrentDefinedConfig()
{
if ( mDefinedId.isEmpty() )
@@ -566,7 +565,6 @@ void QgsAuthOAuth2Edit::selectCurrentDefinedConfig()
}
}

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

// slot
void QgsAuthOAuth2Edit::updateDefinedConfigsCache()
{
QString extradir = leDefinedDirPath->text();
mDefinedConfigsCache.clear();
mDefinedConfigsCache = QgsAuthOAuth2Config::mappedOAuth2ConfigsCache( this, extradir );
}

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

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

// slot

void QgsAuthOAuth2Edit::exportOAuthConfig()
{
if ( !onCustomTab() || !mValid )
@@ -802,7 +797,7 @@ void QgsAuthOAuth2Edit::exportOAuthConfig()
mOAuthConfigCustom->setName( QString::null );
}

// slot

void QgsAuthOAuth2Edit::importOAuthConfig()
{
if ( !onCustomTab() )
@@ -847,13 +842,13 @@ void QgsAuthOAuth2Edit::importOAuthConfig()
loadConfig( configmap );
}

// slot

void QgsAuthOAuth2Edit::descriptionChanged()
{
mOAuthConfigCustom->setDescription( pteDescription->toPlainText() );
}

// slot

void QgsAuthOAuth2Edit::populateAccessMethods()
{
cmbbxAccessMethod->addItem( QgsAuthOAuth2Config::accessMethodString( QgsAuthOAuth2Config::Header ),
@@ -864,7 +859,7 @@ void QgsAuthOAuth2Edit::populateAccessMethods()
static_cast<int>( QgsAuthOAuth2Config::Query ) );
}

// slot

void QgsAuthOAuth2Edit::updateConfigAccessMethod( int indx )
{
mOAuthConfigCustom->setAccessMethod( static_cast<QgsAuthOAuth2Config::AccessMethod>( indx ) );
@@ -887,7 +882,7 @@ void QgsAuthOAuth2Edit::addQueryPairRow( const QString &key, const QString &val
tblwdgQueryPairs->setItem( rowCnt, 1, valItm );
}

// slot

void QgsAuthOAuth2Edit::populateQueryPairs( const QVariantMap &querypairs, bool append )
{
if ( !append )
@@ -903,7 +898,7 @@ void QgsAuthOAuth2Edit::populateQueryPairs( const QVariantMap &querypairs, bool
}
}

// slot

void QgsAuthOAuth2Edit::queryTableSelectionChanged()
{
bool hassel = tblwdgQueryPairs->selectedItems().count() > 0;
@@ -930,7 +925,7 @@ QVariantMap QgsAuthOAuth2Edit::queryPairs() const
return querypairs;
}

// slot

void QgsAuthOAuth2Edit::addQueryPair()
{
addQueryPairRow( QString(), QString() );
@@ -939,13 +934,13 @@ void QgsAuthOAuth2Edit::addQueryPair()
tblwdgQueryPairs->edit( tblwdgQueryPairs->currentIndex() );
}

// slot

void QgsAuthOAuth2Edit::removeQueryPair()
{
tblwdgQueryPairs->removeRow( tblwdgQueryPairs->currentRow() );
}

// slot

void QgsAuthOAuth2Edit::clearQueryPairs()
{
for ( int i = tblwdgQueryPairs->rowCount(); i > 0 ; --i )
@@ -1149,13 +1144,3 @@ void QgsAuthOAuth2Edit::getSoftwareStatementConfig()
}
}

QString QgsAuthOAuth2Edit::registrationEndpoint() const
{
return mRegistrationEndpoint;
}

void QgsAuthOAuth2Edit::setRegistrationEndpoint( const QString &registrationEndpoint )
{
mRegistrationEndpoint = registrationEndpoint;
}

@@ -126,12 +126,6 @@ class QgsAuthOAuth2Edit : public QgsAuthMethodEdit, private Ui::QgsAuthOAuth2Edi

void networkError( QNetworkReply::NetworkError error );

//! For testability
QString registrationEndpoint() const;

//! For testability
void setRegistrationEndpoint( const QString &registrationEndpoint );

private:

void initGui();
@@ -415,8 +415,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationNoEndpoint()
config->setClientId( QString( ) );
config->setClientSecret( QString( ) );
QVariantMap configMap( config->mappedProperties() );
QCOMPARE( configMap["clientId"], QString() );
QCOMPARE( configMap["clientSecret"], QString() );
QCOMPARE( configMap["clientId"].toString(), QString() );
QCOMPARE( configMap["clientSecret"].toString(), QString() );
QgsAuthOAuth2Edit dlg;
QgsStringMap stringMap;
for ( const auto &k : configMap.keys( ) )
@@ -439,8 +439,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistration()
config->setClientId( QString( ) );
config->setClientSecret( QString( ) );
QVariantMap configMap( config->mappedProperties() );
QCOMPARE( configMap["clientId"], QString() );
QCOMPARE( configMap["clientSecret"], QString() );
QCOMPARE( configMap["clientId"].toString(), QString() );
QCOMPARE( configMap["clientSecret"].toString(), QString() );
QgsAuthOAuth2Edit dlg;
QgsStringMap stringMap;
for ( const auto &k : configMap.keys( ) )
@@ -459,7 +459,7 @@ void TestQgsAuthOAuth2Method::testDynamicRegistration()
dlg.leSoftwareStatementConfigUrl->setText( QUrl::fromLocalFile( QStringLiteral( "%1/auth_code_grant_display_code_get_config.json" ).arg( sTestDataDir ) ).toString( ) );
QVERIFY( dlg.btnRegister->isEnabled() );
// Change it to something local
dlg.setRegistrationEndpoint( QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString() );
dlg.mRegistrationEndpoint = QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString();
QTest::mouseClick( dlg.btnRegister, Qt::MouseButton::LeftButton );
while ( dlg.mDownloading )
{
@@ -476,8 +476,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationJwt()
config->setClientId( QString( ) );
config->setClientSecret( QString( ) );
QVariantMap configMap( config->mappedProperties() );
QCOMPARE( configMap["clientId"], QString() );
QCOMPARE( configMap["clientSecret"], QString() );
QCOMPARE( configMap["clientId"].toString(), QString() );
QCOMPARE( configMap["clientSecret"].toString(), QString() );
QgsAuthOAuth2Edit dlg;
QgsStringMap stringMap;
for ( const auto &k : configMap.keys( ) )
@@ -493,7 +493,7 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationJwt()
QCOMPARE( dlg.leSoftwareStatementConfigUrl->text(), QStringLiteral( "http://www.qgis.org/oauth2/registration" ) );
QVERIFY( dlg.btnRegister->isEnabled() );
// Change it to something local
dlg.setRegistrationEndpoint( QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString() );
dlg.mRegistrationEndpoint = QUrl::fromLocalFile( QStringLiteral( "%1/client_information_registration_response.json" ).arg( sTestDataDir ) ).toString();
QTest::mouseClick( dlg.btnRegister, Qt::MouseButton::LeftButton );
while ( dlg.mDownloading )
{

0 comments on commit d8ffdaa

Please sign in to comment.
You can’t perform that action at this time.