Enable Api Functional Test

Closes-Bug: #1646377

Change-Id: I87505a8471fbf8c86ba67d0d4747f51f8ad867e4
This commit is contained in:
Andy Yan 2016-12-01 15:43:17 +08:00
parent 2e31ed68c7
commit b71b747155
3 changed files with 19 additions and 6 deletions

View File

@ -2,6 +2,7 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./valence/tests/unit} $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./valence/tests} $LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./valence/tests/functional} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -11,6 +11,8 @@
# limitations under the License.
import logging
import os.path
from logging.handlers import RotatingFileHandler
from flask import Flask
@ -26,12 +28,14 @@ def setup_app():
app.url_map.strict_slashes = False
# Configure logging
handler = RotatingFileHandler(cfg.log_file, maxBytes=10000, backupCount=1)
handler.setLevel(cfg.log_level)
formatter = logging.Formatter(cfg.log_format)
handler.setFormatter(formatter)
if os.path.isfile(cfg.log_file) and os.access(cfg.log_file, os.W_OK):
handler = RotatingFileHandler(
cfg.log_file, maxBytes=10000, backupCount=1)
handler.setLevel(cfg.log_level)
formatter = logging.Formatter(cfg.log_format)
handler.setFormatter(formatter)
app.logger.addHandler(handler)
app.logger.setLevel(cfg.log_level)
app.logger.addHandler(handler)
return app

View File

@ -0,0 +1,8 @@
from unittest import TestCase
from valence.api.route import app
class FunctionalTest(TestCase):
def setUp(self):
self.app = app.test_client()