re-add the ip to the user message

This commit is contained in:
Christian Heusel
2022-11-17 18:11:36 +01:00
parent 5fb8891da4
commit 1e90b8a185
2 changed files with 12 additions and 11 deletions

View File

@@ -20,6 +20,7 @@
#include "znctest.h"
using testing::HasSubstr;
using testing::Not;
namespace znc_inttest {
namespace {
@@ -61,9 +62,9 @@ TEST_F(ZNCTest, ClientNotifyModule) {
client.Write("znc loadmod clientnotify");
client.ReadUntil("Loaded module");
auto check_not_sent = [](Socket& client, QString wrongAnswer){
auto result = client.ReadRemainder();
EXPECT_FALSE(result.contains(wrongAnswer.toUtf8())) << "Got an answer even though we didnt want one with the given configuration";
auto check_not_sent = [](Socket& client, std::string wrongAnswer){
auto result = QString{client.ReadRemainder()}.toStdString();
EXPECT_THAT(result, Not(HasSubstr((wrongAnswer)))) << "Got an answer from the ClientNotifyModule even though we didnt want one with the given configuration";
};
auto client2 = LoginClient();
@@ -82,20 +83,20 @@ TEST_F(ZNCTest, ClientNotifyModule) {
client.Write("PRIVMSG *clientnotify :NewNotifyOn clientid");
auto client5 = LoginClient("identifier123");
client.ReadUntil(":Another client (identifier123) authenticated as your user. Use the 'ListClients' command to see all 5 clients.");
client.ReadUntil(":Another client (127.0.0.1 / identifier123) authenticated as your user. Use the 'ListClients' command to see all 5 clients.");
auto client6 = LoginClient("identifier123");
check_not_sent(client, ":Another client (identifier123) authenticated as your user. Use the 'ListClients' command to see all 6 clients.");
check_not_sent(client, ":Another client (127.0.0.1 / identifier123) authenticated as your user. Use the 'ListClients' command to see all 6 clients.");
auto client7 = LoginClient("not_identifier123");
client.ReadUntil(":Another client (not_identifier123) authenticated as your user. Use the 'ListClients' command to see all 7 clients.");
client.ReadUntil(":Another client (127.0.0.1 / not_identifier123) authenticated as your user. Use the 'ListClients' command to see all 7 clients.");
// choose to notify from both clientids and new IPs
client.Write("PRIVMSG *clientnotify :NewNotifyOn both");
auto client8 = LoginClient();
check_not_sent(client, ":Another client (127.0.0.1) authenticated as your user. Use the 'ListClients' command to see all 8 clients.");
check_not_sent(client, ":Another client (127.0.0.1 / identifier123) authenticated as your user. Use the 'ListClients' command to see all 8 clients.");
auto client9 = LoginClient("definitely_not_identifier123");
client.ReadUntil(":Another client (definitely_not_identifier123) authenticated as your user. Use the 'ListClients' command to see all 9 clients.");
client.ReadUntil(":Another client (127.0.0.1 / definitely_not_identifier123) authenticated as your user. Use the 'ListClients' command to see all 9 clients.");
}
TEST_F(ZNCTest, ShellModule) {