MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / TEST

Function TEST

dependencies/hueplusplus-1.0.0/test/test_SensorList.cpp:40–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38};
39
40TEST(SensorList, getAsType)
41{
42 auto handler = std::make_shared<MockHttpHandler>();
43 HueCommandAPI commands(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
44
45 SensorList sensors {commands, "/sensors", std::chrono::steady_clock::duration::max()};
46
47 const int id = 2;
48 const nlohmann::json response = {{std::to_string(id), {{"type", "Daylight"}}}};
49
50 EXPECT_CALL(*handler,
51 GETJson("/api/" + getBridgeUsername() + "/sensors", nlohmann::json::object(), getBridgeIp(), getBridgePort()))
52 .WillOnce(Return(response));
53
54 sensors::DaylightSensor daylightSensor = sensors.getAsType<sensors::DaylightSensor>(id);
55 EXPECT_THROW(sensors.getAsType<BlaSensor>(2), HueException);
56}
57
58TEST(SensorList, getAllByType)
59{

Callers

nothing calls this directly

Calls 7

getBridgeIpFunction · 0.85
getBridgePortFunction · 0.85
getBridgeUsernameFunction · 0.85
to_stringFunction · 0.85
emptyMethod · 0.45
refreshMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected