-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Manage sdk unit tests (non-events) (#341)
* test(manage): Advertising unit tests * test(manage): AudioDescription unit tests * test(manage): ClosedCaptions unit tests * test(manage): Device unit tests * test(manage): HDMI-Input unit tests * test(manage): Localization unit tests * test(manage): Privacy unit tests * test(manage): Voice guidance unit tests * test(manage): Account unit tests * test(manage): Secure Storage unit tests * test(manage): User Grant unit tests * test(manage): Wifi unit tests * test(manage): Metrics unit tests * test(manage): AcknowledgeChallenge unit tests * test(manage): Keyboard unit tests * test(manage): PinChallenge unit tests --------- Co-authored-by: Keaton Sentak <[email protected]>
- Loading branch information
1 parent
9ad3187
commit 85a0378
Showing
18 changed files
with
1,853 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "unit.h" | ||
|
||
class AccountTest : public ::testing::Test | ||
{ | ||
protected: | ||
JsonEngine *jsonEngine; | ||
Firebolt::Error error = Firebolt::Error::None; | ||
|
||
void SetUp() override | ||
{ | ||
jsonEngine = new JsonEngine(); | ||
} | ||
|
||
void TearDown() override | ||
{ | ||
delete jsonEngine; | ||
} | ||
}; | ||
|
||
TEST_F(AccountTest, session) | ||
{ | ||
std::string token = "expiresIn"; | ||
int32_t expiresIn = 84000; | ||
Firebolt::IFireboltAccessor::Instance().AccountInterface().session(token, expiresIn, &error); | ||
EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AccountInterface.session() method"; | ||
} |
64 changes: 64 additions & 0 deletions
64
src/sdks/manage/src/cpp/sdk/cpptest/unit/acknowledgeChallengeTest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "unit.h" | ||
|
||
using namespace Firebolt::AcknowledgeChallenge; | ||
|
||
struct AcknowledgeChallengeProvider : public IAcknowledgeChallengeProvider | ||
{ | ||
AcknowledgeChallengeProvider(); | ||
~AcknowledgeChallengeProvider() override = default; | ||
void SendMessage(bool response); | ||
void challenge(const Challenge ¶meters, std::unique_ptr<IAcknowledgeChallengeSession> session) override; | ||
|
||
private: | ||
void startAcknowledgeChallengeSession(const Challenge ¶meters, std::unique_ptr<IAcknowledgeChallengeSession> session); | ||
|
||
private: | ||
std::unique_ptr<IAcknowledgeChallengeSession> _session; | ||
Challenge _parameters; | ||
bool _challengeInput; | ||
}; | ||
|
||
class AcknowledgeChallengeTest : public ::testing::Test | ||
{ | ||
protected: | ||
JsonEngine *jsonEngine; | ||
Firebolt::Error error = Firebolt::Error::None; | ||
AcknowledgeChallengeProvider _acknowledgeChallengeProvider; | ||
|
||
void SetUp() override | ||
{ | ||
jsonEngine = new JsonEngine(); | ||
} | ||
|
||
void TearDown() override | ||
{ | ||
delete jsonEngine; | ||
} | ||
}; | ||
|
||
AcknowledgeChallengeProvider::AcknowledgeChallengeProvider() | ||
: _session(nullptr), _parameters(), _challengeInput(false) | ||
{ | ||
} | ||
|
||
void AcknowledgeChallengeProvider::SendMessage(bool response) | ||
{ | ||
} | ||
|
||
void AcknowledgeChallengeProvider::startAcknowledgeChallengeSession(const Firebolt::AcknowledgeChallenge::Challenge ¶meters, std::unique_ptr<Firebolt::AcknowledgeChallenge::IAcknowledgeChallengeSession> session) | ||
{ | ||
_session = std::move(session); | ||
_parameters = parameters; | ||
_challengeInput = true; | ||
} | ||
|
||
void AcknowledgeChallengeProvider::challenge(const Challenge ¶meters, std::unique_ptr<IAcknowledgeChallengeSession> session) | ||
{ | ||
std::cout << "AcknowledgeChallengeProvider challenge is invoked" << std::endl; | ||
startAcknowledgeChallengeSession(parameters, std::move(session)); | ||
} | ||
|
||
TEST_F(AcknowledgeChallengeTest, registerAcknowledgeChallengeProvider) | ||
{ | ||
Firebolt::IFireboltAccessor::Instance().AcknowledgeChallengeInterface().provide(_acknowledgeChallengeProvider); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.