1
0
mirror of https://github.com/gryf/ferrit.git synced 2026-02-07 16:55:47 +01:00

Added more tests for change merged and comment added events

This commit is contained in:
2019-11-01 12:59:04 +01:00
parent 7338d4f5c3
commit fc46096cf2
4 changed files with 52 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ import subprocess
import time
import unittest
import requests
class BaseTestCase(unittest.TestCase):
def setUp(self):
@@ -25,3 +27,24 @@ class BaseTestCase(unittest.TestCase):
os.killpg(self.process.pid, signal.SIGTERM)
os.unlink('ferrit-http.log')
os.unlink('ferrit-ssh.log')
def _send_and_get_response(self, event_type):
counter = 20
result = None
requests.post('http://localhost:8181/make/event',
data='type=%s' % event_type)
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
return result