コード例 #1
0
 def testListTorrents(self):
     ip = self.lt.ip
     url = "http://%s:%s/list_torrents" % (ip, PORT)
     code, result = post(url, self.lt.data)
     #print code, result
     self.assertEqual(result['ret'], 4)
     print json.dumps(result['msg'], indent=4)
コード例 #2
0
ファイル: rsync_test.py プロジェクト: staticzeng/hermes
 def testRsync(self):
     ip = self.rs.ip
     #url = HOST + "/rsync"
     url = "http://%s:%s/rsync" % (ip, PORT)
     code, msg = post(url, self.rs.data)
     print code, msg
     self.assertEqual(code, 0)
     task_id = msg['task_id']
     status = QueryTaskTest(ip, task_id).waitForOver()
     self.assertEqual(status["ret"], TaskStatus(task_id).SUCC["ret"])
コード例 #3
0
 def testMakeTorrent(self):
     ip = self.mt.ip
     #url = HOST + "/make_torrent"
     url = "http://%s:%s/make_torrent" % (ip, PORT)
     code, msg = post(url, self.mt.data)
     print code, msg
     self.assertEqual(code, 0)
     task_id = msg['task_id']
     status = QueryTaskTest(ip, task_id).waitForOver()
     #self.assertEqual(status["ret"], TaskStatus(task_id).SUCC["ret"])
     #self.assertIn(status["ret"], (TaskStatus(task_id).SUCC["ret"], -1))
     self.assertTrue(status["ret"] in (TaskStatus(task_id).SUCC["ret"], -1))
コード例 #4
0
ファイル: cancel_task_test.py プロジェクト: staticzeng/hermes
 def testCancelTask(self):
     ip = self.ct.ip
     url = "http://%s:%s/cancel_task" % (ip, PORT)
     code, result = post(url, self.ct.data)
     print code, result
     self.assertEqual(result['ret'], 4)
コード例 #5
0
 def testQueryTorrent(self):
     url = "http://%s:%s/query_torrent?torrent_id=%s" \
             % (self.ip, PORT, self.torrent_id)
     #url = MC + "/query_torrent" + "?torrent_id=%s" % self.torrent_id
     code, status = post(url)
     return status
コード例 #6
0
 def testRemoveTorrent(self):
     ip = self.rt.ip
     url = "http://%s:%s/remove_torrent" % (ip, PORT)
     code, result = post(url, self.rt.data)
     print code, result
     self.assertEqual(result['ret'], 4)
コード例 #7
0
 def testQueryTask(self):
     #url = HOST + "/query_task" + "?task_id=%s" % self.task_id
     url = "http://%s:%s/query_task?task_id=%s" \
             % (self.ip, PORT, self.task_id)
     code, status = post(url)
     return status