modifié: superTornado.py

This commit is contained in:
sidya82
2014-03-31 23:08:38 +02:00
parent d593bca4f4
commit 276b4e2213
10 changed files with 861 additions and 53 deletions

View File

@ -1,17 +1,7 @@
4u8jq3J9hEG0ZQ,79af5b0417d02392e22eeea9af539acddf1b7df16c6bf3a83e661774
7HLP,3bd969da01f586774021e72ef6eb802d38e1c263760f3f56b5812760
eU65FDk3c,2e687f8b8b0f97e2951b7b69ac45baf291df1e8a0cb01bd90624e2b0
4NiX4,6ead98789bc7cdcc2fa7702cfe3b10ee280e1d8608fd258a25782045
CsFd4lwXk9,8f61eaa23a728901322d0596cfbf25da27e212162d897fa95d7ac9ac
nghz,64b00fd3a24a5b2ab169cc3891b0d65c6c65e695532eaff2c7259cbd
wSUyyNNKNTlvr,06386e5d7c243bf66f1cd717ebdab48ca33bf75f408da9c95c3fd30a
0s01eGWoY8aGplb,f9a26c9c8e474c73d61ebb2fbadb72b2743c1cb84e1a92abdf433fe7
9HA1lzbFEuYf1rXpKe,df4e71601e2a93f5d17e9599f25acd249f3fb20cf57ed8e1d56aba76
1w,0599c5153b82f9f3a47f45014165e5648edd4e0ff90d5b544d74b629
Qky5HF,50557d97b6dd5abfc4e86ba4ff4e1f4b92b17908fa42791aaf70bc66
hTtP,f92d7aa3b3243d461489c61ef4d536fa01fdf0dfab68d60dd354940f
NohoYCOrW0nw0Zie,af6c0bb741cc5725e6e09eb731cb958e6b67b2e30a65ff8ea7b23394
Ahpx9i65RKUoQTaqc,f5a43e2f60a96ffbe7d75d7f6cfa62bbd170ef7ab36dcc4a233e2a4b
SJEtTanO2FNFUd7MYU,fe6e47c833c2850fd02fa9ed4e17a32e334cf5897ec73a6749466ad8
B8T9ua3vks2YZYCL4Ag,a2bafbc1dcdd406d9717092d497937e9061e400943658827191b53a9
JP,95cbc8568bc02f258132fddf1344a6e558f94c39d20284ee3237f325
J4imqH0XdIxVaJ2B,683aaa5f0213f49142cba1e266a9497bd3ee6bd83e69e1e92a5c0537
ly3Lb87,e72c51dcc38ead510264a2ba8d8158a9ad978a356918c7da437cda54
U1mfA,e650ee34063722bd87ae4b44c7f0be0c349495006546c16e22541aec
MrF,2a02fbcc0987071ad700b0cd15acae0dffcac644117d0522f4d07be0
jgV1CRyQ1HH3DVj,d6b64462bf05af6c8b5d410b88794c41a671860cd936adee41c0f07a
Vt5owCRMuMWchNkcM8p,8c69a549618861013ca04a0d620ba76cc74f4bff521f46381d678da4
8Dk9cSJkrTw,52ae891fce5c45560a1b567e810ae6ef1abfefdf1c15c829d33bb760

View File

@ -1,16 +1,6 @@
VgS4Ia4IvUHC5niHmNR1=ExiJILtyduI
EXTM=lu6ltwn5vYU07mFupP4
0=m4VYOt7MHSZCijA2kPv
0RH0gFjtlFDxg6=JB
0gbS8=duM7RL
TN=hqkUnUdp
3tynRJm91uvM=9t
KmO=s2vnpx
1DZ7EL8mmUT7=Ck
hWMNcDWfdj=xZsqrp3ctcfR0
GWVF2moK=CfFlLHozTeiBj7Rh
jin5jmoevE5msN=9T5
muM=bkRp
cgUGnl8n1=5AGUXFkpSzs
Jb7YlVGMcd6s2=agXT2nzPYkbS
B=y0j02B
eGxmcTxmgd9BL9kKjch=8cb6mZB
dABorrawP=8TZ
fEiSEdIKXQGduvUFL97u=7bF
VW=2A
pelz=GLY59
bNVgvjcXbC=pHrw

View File

@ -9,19 +9,30 @@ from tornado.ioloop import PeriodicCallback
f = open("requestToMi", "w")
class MainHandler(tornado.web.RequestHandler):
class SayHandler(tornado.web.RequestHandler):
def get(self):
print "lol"
source = self.get_argument("source","")
text = self.get_argument("text","")
print"/micom/say.php?source=" + source + "&text=" + text
class LampHandler(tornado.web.RequestHandler):
def get(self):
room = self.get_argument("room","")
order = self.get_argument("order","")
print"/micom/lamp.php?room=" + room + "&order=" + order
application = tornado.web.Application([
(r"/lol", MainHandler)])
(r"/micom/say.php", SayHandler),
(r"micom/lamp.php", LampHandler)])
if __name__ == "__main__":
try :
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(80)
http_server.listen(8080)
tornado.ioloop.IOLoop.instance().start()
except Exception, e :
print e

View File

@ -31,7 +31,19 @@ opener.addheaders = [('User-agent',
print "Hello, I'm botTest :)"
print "I'm here for test MI camera server."
print "I'm not a python script for the server, I'm a browser : \n" + browser.replace(";","")
print "\nI'm starting test with video page where an unconnect user can't normaly access :"
print "\nI'm starting test with main page of the site :"
print "PATH: /"
print "TYPE REQUEST : GET"
print "DATA SEND : -"
print ""
resp = opener.open(base_url+"video")
if resp.geturl()== base_url:
print("OK : receive / page")
else:
print("NOK : not receive / page !")
cj.save()
print "\nI'm continue with video page where an unconnect user can't normaly access :"
print "PATH: /video"
print "TYPE REQUEST : GET"
print "DATA SEND : -"
@ -116,7 +128,7 @@ else:
cj.save()
print "\nNow I have acess to /video i will try to connect to websocket to aquire image :"
print "\nNow I have access to /video I will try to connect to websocket to aquire image :"
print "PATH: /socket "
print "TYPE REQUEST : GET"
print "DATA SEND :"
@ -144,7 +156,7 @@ except Exception, e :
print "NOK : Failed To Connect To Websocket And Received Data"
cj.save()
print "\nI will now try to disconnet :"
print "\nI will now try to disconnect :"
print "PATH: / "
print "TYPE REQUEST : GET"
print "DATA SEND : - "
@ -156,7 +168,7 @@ else:
print("NOK : not redirect to / !")
cj.save()
print "\nI'm now test video for check if i am disconnected :"
print "\nI'm now test video for check If I Am Disconnected :"
print "PATH: /video"
print "TYPE REQUEST : GET"
print "DATA SEND : -"
@ -170,7 +182,7 @@ cj.save()
print "\nNow I Will Try To Connect To The Websocket then I not connected :"
print "\nNow I Will Try To Connect To The Websocket Then I not connected :"
print "PATH: /socket "
print "TYPE REQUEST : GET"
print "DATA SEND :"

View File

@ -107,13 +107,13 @@ class testLogin(object):
err +=1
if err==0:
print "TEST SUCESSFULL : all login were succesfull"
print "TEST SUCESSFULL : All Login Were Succesfull"
else :
print "TEST FAIL: all login were not succesfull"
print "TEST FAIL: All Login Were Not Succesfull"
print "\nTesting invalid keys"
print "\nTesting invalid id and password"
err = 0
for i in range(10):
value = LoginObject.checkLogin(
@ -131,6 +131,40 @@ class testLogin(object):
else :
print "TEST SUCESSFULL : Login Not Ok With Invalid Information"
print "\nTesting invalid id and correct password"
err = 0
for name,passwd in self.assos :
name = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
value = LoginObject.checkLogin(name,passwd)
if value == True:
print "NOK : Return True"
err += 1
else :
print "OK : Return False"
if err>0:
print "TEST FAIL : Login Ok With Invalid Information"
else :
print "TEST SUCESSFULL : Login Not Ok With Invalid Id"
print "\nTesting invalid password and correct id"
err = 0
for name,passwd in self.assos :
passwd = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
value = LoginObject.checkLogin(name,passwd)
if value == True:
print "NOK : Return True"
err += 1
else :
print "OK : Return False"
if err>0:
print "TEST FAIL : Login Ok With Invalid Information"
else :
print "TEST SUCESSFULL : Login Not Ok With Invalid Password"