mirror of
https://github.com/gryf/ferrit.git
synced 2026-02-10 02:25:52 +01:00
Use _send_and_get_response in test_send_patch.
This commit is contained in:
@@ -1,8 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from tests import base
|
from tests import base
|
||||||
|
|
||||||
@@ -10,23 +6,7 @@ from tests import base
|
|||||||
class TestPatchsetCreated(base.BaseTestCase):
|
class TestPatchsetCreated(base.BaseTestCase):
|
||||||
|
|
||||||
def test_send_patch(self):
|
def test_send_patch(self):
|
||||||
counter = 20
|
result = self._send_and_get_response('patchset-created')
|
||||||
result = None
|
|
||||||
requests.post('http://localhost:8181/make/event', data='project='
|
|
||||||
'example&branch=master&type=patchset-created')
|
|
||||||
while counter:
|
|
||||||
if not os.path.exists('ferrit-http.log'):
|
|
||||||
counter -= 1
|
|
||||||
time.sleep(1)
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open('ferrit-http.log') as fobj:
|
|
||||||
result = fobj.read()
|
|
||||||
if not result:
|
|
||||||
time.sleep(1)
|
|
||||||
counter -= 1
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
self.assertTrue(result)
|
self.assertTrue(result)
|
||||||
result = json.loads(result)
|
result = json.loads(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user