Kubernetes integration
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import logging
|
||||
|
||||
import connexion
|
||||
from flask_testing import TestCase
|
||||
|
||||
from openapi_server.encoder import JSONEncoder
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
|
||||
def create_app(self):
|
||||
logging.getLogger('connexion.operation').setLevel('ERROR')
|
||||
app = connexion.App(__name__, specification_dir='../openapi/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('openapi.yaml', pythonic_params=True)
|
||||
return app.app
|
||||
@@ -0,0 +1,52 @@
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
import unittest
|
||||
|
||||
from flask import json
|
||||
from six import BytesIO
|
||||
|
||||
from openapi_server.test import BaseTestCase
|
||||
|
||||
|
||||
class TestDrohneController(BaseTestCase):
|
||||
"""DrohneController integration test stubs"""
|
||||
|
||||
@unittest.skip("image/* not supported by Connexion")
|
||||
def test_detect_post(self):
|
||||
"""Test case for detect_post
|
||||
|
||||
|
||||
"""
|
||||
body = (BytesIO(b'some file data'), 'file.txt')
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'image/*',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/detect',
|
||||
method='POST',
|
||||
headers=headers,
|
||||
data=json.dumps(body),
|
||||
content_type='image/*')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_image_image_id_get(self):
|
||||
"""Test case for image_image_id_get
|
||||
|
||||
|
||||
"""
|
||||
headers = {
|
||||
'Accept': 'image/*',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/image/<image_id>'.format(image_id='image_id_example'),
|
||||
method='GET',
|
||||
headers=headers)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user