Changeset - f8d3089f4e3a
[Not reviewed]
0 2 3
Jan Kaluza - 14 years ago 2011-06-09 08:36:43
hanzz.k@gmail.com
login_bad_name2 test
5 files changed with 56 insertions and 2 deletions:
0 comments (0 inline, 0 general)
tests/CMakeLists.txt
Show inline comments
 
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})
tests/login_bad_name2/.nolibircclient-qt
Show inline comments
 
new file 100644
tests/login_bad_name2/CMakeLists.txt
Show inline comments
 
new file 100644
 
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)
 
tests/login_bad_name2/main.cpp
Show inline comments
 
new file 100644
 
#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;
 
}
tests/runtests.py
Show inline comments
 
@@ -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()
 

	
 

	
0 comments (0 inline, 0 general)