зеркало из https://github.com/mozilla/MozDef.git
Merge pull request #714 from mozilla/update_status_apis
Self describe the api type (loginput,restapi) in status route
This commit is contained in:
Коммит
68d408e29a
|
@ -23,7 +23,7 @@ def status():
|
|||
request.body.close()
|
||||
response.status = 200
|
||||
response.content_type = "application/json"
|
||||
response.body = json.dumps(dict(status='ok'))
|
||||
response.body = json.dumps(dict(status='ok', service='loginput'))
|
||||
return response
|
||||
|
||||
@route('/test')
|
||||
|
|
|
@ -68,7 +68,7 @@ def status():
|
|||
request.body.close()
|
||||
response.status = 200
|
||||
response.content_type = "application/json"
|
||||
response.body = json.dumps(dict(status='ok'))
|
||||
response.body = json.dumps(dict(status='ok', service='restapi'))
|
||||
sendMessgeToPlugins(request, response, 'status')
|
||||
return response
|
||||
|
||||
|
|
|
@ -20,7 +20,11 @@ import json
|
|||
|
||||
|
||||
class AlertTestSuite(UnitTestSuite):
|
||||
def teardown(self):
|
||||
os.chdir(self.orig_path)
|
||||
|
||||
def setup(self):
|
||||
self.orig_path = os.getcwd()
|
||||
super(AlertTestSuite, self).setup()
|
||||
|
||||
alerts_dir = os.path.join(os.path.dirname(__file__), "../../alerts/")
|
||||
|
|
|
@ -14,13 +14,12 @@ sample_config = DotDict()
|
|||
sample_config.configfile = os.path.join(os.path.dirname(__file__), '../../loginput/index.conf')
|
||||
OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../loginput/"))
|
||||
import index
|
||||
reload(index)
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
|
||||
|
||||
|
||||
class LoginputTestSuite(HTTPTestSuite):
|
||||
|
||||
def setup(self):
|
||||
from loginput import index
|
||||
self.application = index.application
|
||||
super(LoginputTestSuite, self).setup()
|
||||
|
|
|
@ -7,6 +7,13 @@ class TestTestRoute(LoginputTestSuite):
|
|||
status_code = 200
|
||||
body = ''
|
||||
|
||||
|
||||
class TestStatusRoute(LoginputTestSuite):
|
||||
routes = ['/status', '/status/']
|
||||
|
||||
status_code = 200
|
||||
body = '{"status": "ok", "service": "loginput"}'
|
||||
|
||||
# Routes left need to have unit tests written for:
|
||||
# @route('/_bulk',method='POST')
|
||||
# @route('/_bulk/',method='POST')
|
||||
|
|
|
@ -14,14 +14,12 @@ sample_config = DotDict()
|
|||
sample_config.configfile = os.path.join(os.path.dirname(__file__), '../../rest/index.conf')
|
||||
OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))
|
||||
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../rest/"))
|
||||
import index
|
||||
reload(index)
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
|
||||
|
||||
|
||||
class RestTestSuite(HTTPTestSuite):
|
||||
|
||||
def setup(self):
|
||||
from rest import index
|
||||
self.application = index.application
|
||||
super(RestTestSuite, self).setup()
|
||||
|
|
|
@ -27,7 +27,7 @@ class TestStatusRoute(RestTestSuite):
|
|||
routes = ['/status', '/status/']
|
||||
|
||||
status_code = 200
|
||||
body = '{"status": "ok"}'
|
||||
body = '{"status": "ok", "service": "restapi"}'
|
||||
|
||||
|
||||
class TestKibanaDashboardsRoute(RestTestSuite):
|
||||
|
|
Загрузка…
Ссылка в новой задаче