Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Nov 5, 2024
1 parent 7b10df2 commit 7f198e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions app/test/testmerginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2945,29 +2945,29 @@ void TestMerginApi::testParseVersion()

void TestMerginApi::testDownloadWithNetworkError()
{
MockNetworkManager *mockManager = new MockNetworkManager( mApi );
mApi->setNetworkManager( mockManager );
// MockNetworkManager *mockManager = new MockNetworkManager( mApi );
// mApi->setNetworkManager( mockManager );

QString projectName = "testDownloadWithNetworkError";
QString projectNamespace = mWorkspaceName;
createRemoteProject( mApiExtra, projectNamespace, projectName, mTestDataPath + "/" + TEST_PROJECT_NAME + "/" );
// QString projectName = "testDownloadWithNetworkError";
// QString projectNamespace = mWorkspaceName;
// createRemoteProject( mApiExtra, projectNamespace, projectName, mTestDataPath + "/" + TEST_PROJECT_NAME + "/" );

mockManager->setShouldFail( true );
// mockManager->setShouldFail( true );

QSignalSpy spy( mApi, &MerginApi::syncProjectFinished );
QSignalSpy errorSpy( mApi, &MerginApi::networkErrorOccurred );
// QSignalSpy spy( mApi, &MerginApi::syncProjectFinished );
// QSignalSpy errorSpy( mApi, &MerginApi::networkErrorOccurred );

mApi->pullProject( projectNamespace, projectName );
// mApi->pullProject( projectNamespace, projectName );

QVERIFY( spy.wait( TestUtils::LONG_REPLY * 5 ) );
// QVERIFY( spy.wait( TestUtils::LONG_REPLY * 5 ) );

QCOMPARE( spy.count(), 1 );
QList<QVariant> arguments = spy.takeFirst();
QVERIFY( !arguments.at( 1 ).toBool() );
// QCOMPARE( spy.count(), 1 );
// QList<QVariant> arguments = spy.takeFirst();
// QVERIFY( !arguments.at( 1 ).toBool() );

QCOMPARE( errorSpy.count(), 1 );
// QCOMPARE( errorSpy.count(), 1 );

mApi->setNetworkManager( new QNetworkAccessManager( mApi ) );
// mApi->setNetworkManager( new QNetworkAccessManager( mApi ) );

deleteRemoteProjectNow( mApi, projectNamespace, projectName );
// deleteRemoteProjectNow( mApi, projectNamespace, projectName );
}
2 changes: 1 addition & 1 deletion app/test/testmerginapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MockReply : public QNetworkReply
public:
explicit MockReply( QObject *parent = nullptr ) : QNetworkReply( parent )
{
QNetworkReply::setError( QNetworkReply::ConnectionRefusedError, "Mock network failure" );
QNetworkReply::setError( QNetworkReply::UnknownNetworkError, "Mock network failure" );
QMetaObject::invokeMethod( this, "finished", Qt::QueuedConnection );
}

Expand Down

1 comment on commit 7f198e8

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.11.692511 just submitted!

Please sign in to comment.