Skip to content

Commit

Permalink
tests: Add CheckInCurrent basic test
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Detsch <[email protected]>
  • Loading branch information
detsch committed Jul 26, 2024
1 parent 428abad commit 237dde6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/apiclient_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,30 @@ TEST_F(ApiClientTest, InstallTargetWithHackedApps) {
ASSERT_EQ(nullptr, installer);
}

TEST_F(ApiClientTest, CheckInCurrent) {
auto lite_client = createLiteClient(InitialVersion::kOn);
AkliteClient client(lite_client);
auto result = client.CheckIn();

auto events = getDeviceGateway().getEvents();
ASSERT_EQ(2, events.size());
auto val = getDeviceGateway().readSotaToml();
ASSERT_NE(std::string::npos, val.find("[pacman]"));

ASSERT_EQ(CheckInResult::Status::Ok, result.status);
ASSERT_EQ(1, result.Targets().size());

ASSERT_TRUE(getDeviceGateway().resetSotaToml());
ASSERT_TRUE(resetEvents());

// No events should be generated, and no callback invoked
EXPECT_CALL(*lite_client, callback(testing::_, testing::_, testing::_)).Times(0);
result = client.CheckInCurrent();
ASSERT_EQ(1, result.Targets().size());
events = getDeviceGateway().getEvents();
ASSERT_EQ(0, events.size());
}

// Tests using Extended Aklite Client methods:
TEST_F(ApiClientTest, ExtApiRollback) {
auto liteclient = createLiteClient();
Expand Down

0 comments on commit 237dde6

Please sign in to comment.