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

Function TEST

dependencies/hueplusplus-1.0.0/test/test_ResourceList.cpp:67–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65};
66
67TEST(ResourceList, refresh)
68{
69 auto handler = std::make_shared<MockHttpHandler>();
70 HueCommandAPI commands(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler);
71
72 const std::string path = "/resources";
73 {
74 ResourceList<TestResource, int> list(commands, path, std::chrono::steady_clock::duration::max());
75 EXPECT_CALL(*handler,
76 GETJson("/api/" + getBridgeUsername() + path, nlohmann::json::object(), getBridgeIp(), getBridgePort()))
77 .Times(2)
78 .WillRepeatedly(Return(nlohmann::json::object()));
79 list.refresh();
80 list.refresh();
81 Mock::VerifyAndClearExpectations(handler.get());
82 }
83 {
84 auto baseCache = std::make_shared<APICache>("", commands, std::chrono::steady_clock::duration::max(), nullptr);
85 ResourceList<TestResource, int> list(baseCache, "resources", std::chrono::steady_clock::duration::max());
86 InSequence s;
87 EXPECT_CALL(
88 *handler, GETJson("/api/" + getBridgeUsername(), nlohmann::json::object(), getBridgeIp(), getBridgePort()))
89 .WillOnce(Return(nlohmann::json {{"resources", nlohmann::json::object()}}));
90 EXPECT_CALL(*handler,
91 GETJson("/api/" + getBridgeUsername() + path, nlohmann::json::object(), getBridgeIp(), getBridgePort()))
92 .Times(2)
93 .WillRepeatedly(Return(nlohmann::json::object()));
94 list.refresh();
95 list.refresh();
96 list.refresh();
97 Mock::VerifyAndClearExpectations(handler.get());
98 }
99}
100
101TEST(ResourceList, get)
102{

Callers

nothing calls this directly

Calls 15

getBridgeIpFunction · 0.85
getBridgePortFunction · 0.85
getBridgeUsernameFunction · 0.85
to_stringFunction · 0.85
TestResourceClass · 0.85
TestResourceFactoryClass · 0.85
getAllMethod · 0.80
removeMethod · 0.80
searchMethod · 0.80
getNewDevicesMethod · 0.80
isScanActiveMethod · 0.80
refreshMethod · 0.45

Tested by

no test coverage detected