|
2 | 2 | // Licensed under the MIT License.
|
3 | 3 |
|
4 | 4 | #include "../mock/MockWebServer.h"
|
| 5 | +#include "../mock/ProxyServer.h" |
5 | 6 | #include "../util/TestHelper.h"
|
6 | 7 | #include "TestOverride.h"
|
7 | 8 | #include "sfsclient/SFSClient.h"
|
@@ -112,6 +113,19 @@ TEST("Testing SFSClient::GetLatestDownloadInfo()")
|
112 | 113 | CheckMockContent(contents[0], c_version);
|
113 | 114 | }
|
114 | 115 |
|
| 116 | + SECTION("No attributes + proxy") |
| 117 | + { |
| 118 | + test::ProxyServer proxy; |
| 119 | + |
| 120 | + params.productRequests = {{c_productName, {}}}; |
| 121 | + params.proxy = proxy.GetBaseUrl(); |
| 122 | + REQUIRE(sfsClient->GetLatestDownloadInfo(params, contents) == Result::Success); |
| 123 | + REQUIRE(contents.size() == 1); |
| 124 | + CheckMockContent(contents[0], c_version); |
| 125 | + |
| 126 | + REQUIRE(proxy.Stop() == Result::Success); |
| 127 | + } |
| 128 | + |
115 | 129 | SECTION("With attributes")
|
116 | 130 | {
|
117 | 131 | const TargetingAttributes attributes{{"attr1", "value"}};
|
@@ -143,6 +157,8 @@ TEST("Testing SFSClient::GetLatestDownloadInfo()")
|
143 | 157 | CheckMockContent(contents[0], c_nextVersion);
|
144 | 158 | }
|
145 | 159 | }
|
| 160 | + |
| 161 | + REQUIRE(server.Stop() == Result::Success); |
146 | 162 | }
|
147 | 163 |
|
148 | 164 | TEST("Testing SFSClient::GetLatestAppDownloadInfo()")
|
@@ -240,10 +256,13 @@ TEST("Testing SFSClient::GetLatestAppDownloadInfo()")
|
240 | 256 | params.productRequests = {{c_productName, {}}};
|
241 | 257 | auto result = sfsClient->GetLatestAppDownloadInfo(params, contents);
|
242 | 258 | REQUIRE(result.GetCode() == Result::ServiceUnexpectedContentType);
|
243 |
| - REQUIRE(result.GetMsg() == |
244 |
| - "Unexpected content type [Generic] returned by the service does not match the expected [App]"); |
| 259 | + REQUIRE( |
| 260 | + result.GetMsg() == |
| 261 | + R"(The service returned entity "testProduct" with content type [Generic] while the expected type was [App])"); |
245 | 262 | REQUIRE(contents.empty());
|
246 | 263 | }
|
| 264 | + |
| 265 | + REQUIRE(server.Stop() == Result::Success); |
247 | 266 | }
|
248 | 267 |
|
249 | 268 | TEST("Testing SFSClient retry behavior")
|
@@ -437,4 +456,6 @@ TEST("Testing SFSClient retry behavior")
|
437 | 456 | }
|
438 | 457 | }
|
439 | 458 | }
|
| 459 | + |
| 460 | + REQUIRE(server.Stop() == Result::Success); |
440 | 461 | }
|
0 commit comments