fixing test cases

This commit is contained in:
DuckSoft 2020-05-16 16:34:03 +08:00
parent c6590aeda4
commit 1520ad8907
No known key found for this signature in database
GPG Key ID: 7A3A9FA6E4FD4A8D

View File

@ -16,29 +16,28 @@ SCENARIO("Test Parse Shadowsocks url", "[ParseSSUrl]")
{
auto c = ss::Deserialize("ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4", &alias, &err);
s = ShadowSocksServerObject::fromJson(QJsonIO::GetValue(c, "outbounds", 0, "settings", "servers", 0));
REQUIRE(s.address == "192.168.100.1");
REQUIRE(s.address.toStdString() == "192.168.100.1");
REQUIRE(s.port == 8888);
REQUIRE(s.password == "test");
REQUIRE(s.method == "bf-cfb");
REQUIRE(s.password.toStdString() == "test");
REQUIRE(s.method.toStdString() == "bf-cfb");
}
WHEN("the url with padding")
{
auto c = ss::Deserialize("ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xLjE6ODM4OA==", &alias, &err);
s = ShadowSocksServerObject::fromJson(QJsonIO::GetValue(c, "outbounds", 0, "settings", "servers", 0));
REQUIRE(s.address == "192.168.1.1");
REQUIRE(s.address.toStdString() == "192.168.1.1");
REQUIRE(s.port == 8388);
REQUIRE(s.password == "test");
REQUIRE(s.method == "bf-cfb");
REQUIRE(s.password.toStdString() == "test");
REQUIRE(s.method.toStdString() == "bf-cfb");
}
WHEN("the with remarks")
{
auto c = ss::Deserialize(",ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4#example-server", &alias, &err);
auto c = ss::Deserialize("ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4#example-server", &alias, &err);
s = ShadowSocksServerObject::fromJson(QJsonIO::GetValue(c, "outbounds", 0, "settings", "servers", 0));
qDebug() << s.address << '\n';
REQUIRE(s.address == "192.168.100.1");
REQUIRE(s.address.toStdString() == "192.168.100.1");
REQUIRE(s.port == 8888);
REQUIRE(s.password == "test");
REQUIRE(s.method == "bf-cfb");
REQUIRE(s.password.toStdString() == "test");
REQUIRE(s.method.toStdString() == "bf-cfb");
}
}
}