| 257 | } |
| 258 | |
| 259 | void TestAuthentication::testController_data() |
| 260 | { |
| 261 | QTest::addColumn<QString>("url"); |
| 262 | QTest::addColumn<Headers>("headers"); |
| 263 | QTest::addColumn<int>("status"); |
| 264 | QTest::addColumn<QByteArray>("output"); |
| 265 | |
| 266 | // Auth based on query data |
| 267 | Headers headers; |
| 268 | QUrlQuery query; |
| 269 | query.addQueryItem(u"id"_s, u"foo"_s); |
| 270 | query.addQueryItem(u"password"_s, u"123"_s); |
| 271 | QTest::newRow("auth-test00") << u"/authentication/test/authenticate?"_s + |
| 272 | query.toString(QUrl::FullyEncoded) |
| 273 | << headers << 200 << QByteArrayLiteral("fail"); |
| 274 | |
| 275 | query.clear(); |
| 276 | query.addQueryItem(u"id"_s, u"foo"_s); |
| 277 | query.addQueryItem(u"password"_s, u"321"_s); |
| 278 | QTest::newRow("auth-test01") << u"/authentication/test/authenticate?"_s + |
| 279 | query.toString(QUrl::FullyEncoded) |
| 280 | << headers << 200 << QByteArrayLiteral("fail"); |
| 281 | |
| 282 | query.clear(); |
| 283 | query.addQueryItem(u"id"_s, u"foo"_s); |
| 284 | query.addQueryItem(u"password"_s, u"123"_s); |
| 285 | QTest::newRow("auth-user-test00") |
| 286 | << u"/authentication/test/authenticate_user?"_s + query.toString(QUrl::FullyEncoded) |
| 287 | << headers << 200 << QByteArrayLiteral("ok"); |
| 288 | |
| 289 | query.clear(); |
| 290 | query.addQueryItem(u"id"_s, u"foo"_s); |
| 291 | query.addQueryItem(u"password"_s, u"321"_s); |
| 292 | QTest::newRow("auth-user-test01") |
| 293 | << u"/authentication/test/authenticate_user?"_s + query.toString(QUrl::FullyEncoded) |
| 294 | << headers << 200 << QByteArrayLiteral("fail"); |
| 295 | |
| 296 | query.clear(); |
| 297 | query.addQueryItem(u"id"_s, u"bar"_s); |
| 298 | query.addQueryItem(u"password"_s, u"321"_s); |
| 299 | QTest::newRow("auth-user-test02") |
| 300 | << u"/authentication/test/authenticate_user?"_s + query.toString(QUrl::FullyEncoded) |
| 301 | << headers << 200 << QByteArrayLiteral("ok"); |
| 302 | |
| 303 | query.clear(); |
| 304 | query.addQueryItem(u"id"_s, u"bar"_s); |
| 305 | query.addQueryItem(u"password"_s, u"123"_s); |
| 306 | QTest::newRow("auth-user-test03") |
| 307 | << u"/authentication/test/authenticate_user?"_s + query.toString(QUrl::FullyEncoded) |
| 308 | << headers << 200 << QByteArrayLiteral("fail"); |
| 309 | |
| 310 | query.clear(); |
| 311 | query.addQueryItem(u"id"_s, u"foo"_s); |
| 312 | query.addQueryItem(u"password"_s, u"123"_s); |
| 313 | QTest::newRow("auth-user-realm-test00") |
| 314 | << u"/authentication/test/authenticate_user_realm/hashed?"_s + |
| 315 | query.toString(QUrl::FullyEncoded) |
| 316 | << headers << 200 << QByteArrayLiteral("ok"); |
nothing calls this directly
no test coverage detected