Esempio n. 1
0
void FTPClientSessionTest::testLogin1()
{
	DialogServer server;
	server.addResponse("220 localhost FTP ready");
	FTPClientSession session("localhost", server.port());
	assert (session.isOpen());
	assert (!session.isLoggedIn());
	login(server, session);
	assert (session.isOpen());
	assert (session.isLoggedIn());
	server.addResponse("221 Good Bye");
	session.logout();
	assert (session.isOpen());
	assert (!session.isLoggedIn());

	server.clearCommands();
	server.clearResponses();
	login(server, session);
	assert (session.isOpen());
	assert (session.isLoggedIn());
	server.addResponse("221 Good Bye");
	session.close();
	assert (!session.isOpen());
	assert (!session.isLoggedIn());
}
Esempio n. 2
0
void FTPClientSessionTest::testLogin2()
{
	DialogServer server;
	server.addResponse("220 localhost FTP ready");
	server.addResponse("331 Password required");
	server.addResponse("230 Welcome");
	server.addResponse("200 Type set to I");
	FTPClientSession session("localhost", server.port(), "user", "password");
	assert (session.isOpen());
	assert (session.isLoggedIn());
	server.addResponse("221 Good Bye");
	session.close();
	assert (!session.isOpen());
	assert (!session.isLoggedIn());

	server.clearCommands();
	server.clearResponses();
	server.addResponse("220 localhost FTP ready");
	server.addResponse("331 Password required");
	server.addResponse("230 Welcome");
	server.addResponse("200 Type set to I");
	session.open("localhost", server.port(), "user", "password");
	assert (session.isOpen());
	assert (session.isLoggedIn());
	server.addResponse("221 Good Bye");
	session.close();
	assert (!session.isOpen());
	assert (!session.isLoggedIn());
}