Changeset - 512571a406bb
[Not reviewed]
0 2 0
Jan Kaluza - 10 years ago 2015-12-24 12:19:07
jkaluza@redhat.com
Fix slack test
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
tests/slack_jabber/jabber_slack_test.cfg
Show inline comments
 
[service]
 
frontend=slack
 
jid = localhostxmpp
 
password = secret
 
server = 0.0.0.0
 
port = 5223
 
server_mode = 0
 
backend_host=127.0.0.1
 
pidfile=./test.pid
 
# < this option doesn't work yet
 
#backend_port=10001
 
admin_jid=admin
 
admin_password=test
 
#cert=server.pfx #patch to PKCS#12 certificate
 
#cert_password=test #password to that certificate if any
 
users_per_backend=10
 
#backend=../..//backends/swiften/spectrum2_swiften_backend
 
#backend=../../../backends/twitter/spectrum2_twitter_backend
 
backend=../../backends/libpurple/spectrum2_libpurple_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=any
 
#protocol=prpl-icq
 
working_dir=./
 
portfile=./$jid.port
 
irc_server=localhost
 

	
 
[backend]
 
#default_avatar=catmelonhead.jpg
 
#no_vcard_fetch=true
 

	
 
[logging]
 
#config=logging.cfg # log4cxx/log4j logging configuration file
 
#backend_config=/home/hanzz/code/libtransport/spectrum/src/backend-logging.cfg # log4cxx/log4j logging configuration file for backends
 

	
 
[database]
 
type=sqlite3 # or "none" without database backend
 
database=users.sqlite
 
database=slack.sql
 
#prefix=twitter
 
#type = mysql # or "none" without database backend.......................................................................................................................
 
#database = test
 
#prefix=
 
#user=root
 
#password=yourrootsqlpassword
 
#encryption_key=hanzzik
tests/start.py
Show inline comments
 
@@ -118,92 +118,92 @@ class LibcommuniServerModeSingleServerConf(BaseTest):
 

	
 
class LibcommuniServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "../libcommuni/irc_test2.cfg", True, "#channel%localhost@localhost")
 
		self.directory = "../libcommuni/"
 

	
 
	def pre_test(self):
 
		os.system("ngircd -f ../libcommuni/ngircd.conf &")
 

	
 
	def post_test(self):
 
		os.system("killall ngircd 2>/dev/null")
 
		os.system("killall spectrum2_libcommuni_backend 2>/dev/null")
 

	
 
class JabberServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "../libpurple_jabber/jabber_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		self.directory = "../libpurple_jabber/"
 
		self.client_jid = "client%localhost@localhostxmpp"
 
		self.responder_jid = "responder%localhost@localhostxmpp"
 

	
 
	def skip_test(self, test):
 
		if test in ["muc_whois.py", "muc_change_topic.py"]:
 
			return True
 
		return False
 

	
 
	def pre_test(self):
 
		os.system("prosody --config ../libpurple_jabber/prosody.cfg.lua >prosody.log &")
 
		time.sleep(3)
 
		os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register client%localhost@localhostxmpp client@localhost password 2>/dev/null >/dev/null")
 
		os.system("../../spectrum_manager/src/spectrum2_manager -c ../libpurple_jabber/manager.conf localhostxmpp register responder%localhost@localhostxmpp responder@localhost password 2>/dev/null >/dev/null")
 

	
 
	def post_test(self):
 
		os.system("killall lua-5.1 2>/dev/null")
 
		os.system("killall spectrum2_libpurple_backend 2>/dev/null")
 

	
 
class JabberSlackServerModeConf(BaseTest):
 
	def __init__(self):
 
		BaseTest.__init__(self, "../slack_jabber/jabber_slack_test.cfg", True, "room%conference.localhost@localhostxmpp")
 
		self.directory = "../slack_jabber/"
 
		self.client_jid = "client@localhost"
 
		self.client_room = "room@conference.localhost"
 
		self.responder_jid = "owner@spectrum2tests.xmpp.slack.com"
 
		self.responder_password = "spectrum2tests.rkWHkOrjYucxsmBVkA9K"
 
		self.responder_room = "spectrum2_room@conference.spectrum2tests.xmpp.slack.com"
 
		self.responder_nick = "owner"
 
		self.responder_roompassword = "spectrum2tests.rkWHkOrjYucxsmBVkA9K"
 

	
 
	def skip_test(self, test):
 
		os.system("cp ../slack_jabber/slack.sql users.sqlite")
 
		os.system("cp ../slack_jabber/slack.sql .")
 
		if test in ["muc_whois.py", "muc_change_topic.py", "muc_join_leave.py", "muc_pm.py"]:
 
			return True
 
		return False
 

	
 
	def pre_test(self):
 
		os.system("prosody --config ../slack_jabber/prosody.cfg.lua > prosody.log &")
 
		#time.sleep(3)
 
		#os.system("../../../spectrum_manager/src/spectrum2_manager -c manager.conf localhostxmpp set_oauth2_code xoxb-17213576196-VV2K8kEwwrJhJFfs5YWv6La6 use_bot_token 2>/dev/null >/dev/null")
 

	
 
	def post_test(self):
 
		os.system("killall lua-5.1 2>/dev/null")
 
		os.system("killall spectrum2_libpurple_backend 2>/dev/null")
 

	
 
configurations = []
 
configurations.append(LibcommuniServerModeSingleServerConf())
 
configurations.append(LibcommuniServerModeConf())
 
configurations.append(JabberServerModeConf())
 
configurations.append(JabberSlackServerModeConf())
 

	
 
exitcode = 0
 

	
 
for conf in configurations:
 
	for f in os.listdir(conf.directory):
 
		if not f.endswith(".py") or f == "start.py":
 
			continue
 

	
 
		if len(sys.argv) == 2 and sys.argv[1] != f:
 
			continue
 

	
 
		print conf.__class__.__name__ + ": Starting " + f + " test ..."
 
		test = imp.load_source('test', conf.directory + f)
 
		if conf.skip_test(f):
 
			print "Skipped."
 
			continue
 
		#try:
 
		ret = conf.start(test.Client, test.Responder)
 
		#except:
 
			#ret = False
 
		if not ret:
 
			exitcode = -1
 

	
 
sys.exit(exitcode)
 

	
0 comments (0 inline, 0 general)