login_bad_name2 test
This commit is contained in:
parent
568d2e62b7
commit
f8d3089f4e
5 changed files with 56 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
ADD_SUBDIRECTORY(login)
|
||||
ADD_SUBDIRECTORY(login_bad_name)
|
||||
ADD_SUBDIRECTORY(login_bad_name2)
|
||||
|
||||
add_custom_target(tests python runtests.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
|
0
tests/login_bad_name2/.nolibircclient-qt
Normal file
0
tests/login_bad_name2/.nolibircclient-qt
Normal file
6
tests/login_bad_name2/CMakeLists.txt
Normal file
6
tests/login_bad_name2/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
FILE(GLOB SRC *.cpp)
|
||||
|
||||
ADD_EXECUTABLE(login_bad_name2_test ${SRC})
|
||||
|
||||
TARGET_LINK_LIBRARIES(login_bad_name2_test transport ${SWIFTEN_LIBRARIES} -lgconf-2 -lgobject-2.0 -lglib-2.0)
|
||||
|
45
tests/login_bad_name2/main.cpp
Normal file
45
tests/login_bad_name2/main.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <iostream>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <Swiften/Swiften.h>
|
||||
#include <Swiften/Client/ClientOptions.h>
|
||||
|
||||
using namespace Swift;
|
||||
using namespace boost;
|
||||
|
||||
Client* client;
|
||||
|
||||
static void handleDisconnected(const boost::optional<ClientError> &error) {
|
||||
exit(error->getType() != ClientError::AuthenticationFailedError);
|
||||
}
|
||||
|
||||
static void handleConnected() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void handleMessageReceived(Message::ref message) {
|
||||
// Echo back the incoming message
|
||||
message->setTo(message->getFrom());
|
||||
message->setFrom(JID());
|
||||
client->sendMessage(message);
|
||||
}
|
||||
|
||||
int main(int, char **argv) {
|
||||
SimpleEventLoop eventLoop;
|
||||
BoostNetworkFactories networkFactories(&eventLoop);
|
||||
|
||||
JID jid(std::string("something") + JID(argv[1]).getNode(), JID(argv[1]).getDomain());
|
||||
client = new Client(jid, argv[2], &networkFactories);
|
||||
client->setAlwaysTrustCertificates();
|
||||
client->onConnected.connect(&handleConnected);
|
||||
client->onDisconnected.connect(bind(&handleDisconnected, _1));
|
||||
client->onMessageReceived.connect(bind(&handleMessageReceived, _1));
|
||||
ClientOptions opt;
|
||||
opt.allowPLAINOverNonTLS = true;
|
||||
client->connect(opt);
|
||||
|
||||
eventLoop.run();
|
||||
|
||||
delete client;
|
||||
return 0;
|
||||
}
|
|
@ -39,6 +39,9 @@ def one_test_run():
|
|||
if not os.path.exists(binary):
|
||||
continue
|
||||
|
||||
if os.path.exists(d + "/.no" + backend):
|
||||
continue
|
||||
|
||||
p = run_spectrum(backend, d)
|
||||
|
||||
if backend.find("purple") >= 0:
|
||||
|
@ -62,7 +65,6 @@ def one_test_run():
|
|||
|
||||
os.system("killall spectrum 2> /dev/null")
|
||||
|
||||
while True:
|
||||
one_test_run()
|
||||
one_test_run()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue