Files
llink/tests/testauthmanager.cpp
T

27 lines
678 B
C++

#include "testauthmanager.h"
#include <QSignalSpy>
TestAuthManager::TestAuthManager(QObject *parent) : QObject{parent}, m_authManager(new AuthManager(this))
{
}
void TestAuthManager::add()
{
}
// FIX: invalid test without access to emailed code
void TestAuthManager::testSignIn()
{
QSignalSpy codeSent(m_authManager, &AuthManager::codeSentToEmail);
m_authManager->requestSignInCode("[email protected]");
QVERIFY(codeSent.wait(5000));
QCOMPARE(codeSent.count(), 1);
QSignalSpy signedIn(m_authManager, &AuthManager::isSignedInChanged);
m_authManager->signIn("0000");
QVERIFY(signedIn.wait(5000));
QCOMPARE(signedIn.count(), 1);
}
QTEST_MAIN(TestAuthManager)