예제 #1
0
    def setUp(self) -> None:
        """
        Client Test setup
        Set Environment variable "SETTINGS_FILE_PATH" to project pacjage.ini path
        """
        os.environ["SETTINGS_FILE_PATH"] = str(Path(BASE_PATH, "package.ini"))
        from packageship.application import init_app
        app = init_app("query")

        super(ClientTest, self).setUp()
        self.client = app.test_client()
        Response.text = Response.data
        Response.content = Response.data
예제 #2
0
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# ******************************************************************************/
# -*- coding:utf-8 -*-
"""
test get table col info
"""
from test.base_code.read_data_base import ReadTestBase
import unittest
from packageship.application import init_app
from test.common_files.constant import ResponseCode
from packageship.application.apps.package.view import TableColView

app = init_app('query')
table_col = TableColView()


class TestTableCol(ReadTestBase):
    """
    table col acquisition test
    """
    BASE_URL = "/packages/tablecol"
    REQUESTS_KWARGS = {"url": "", "method": "GET"}

    def test_table_col(self):
        """
        Test the actual table col data sheet
        """
        self.REQUESTS_KWARGS["url"] = self.BASE_URL
예제 #3
0
import os

try:
    from gevent import monkey

    monkey.patch_all(ssl=False)

    from packageship.application import init_app

    if not os.path.exists(os.environ.get('SETTINGS_FILE_PATH')):
        raise RuntimeError(
            'System configuration file:%s' %
            os.environ.get('SETTINGS_FILE_PATH'),
            'does not exist, software service cannot be started')

    app = init_app("query")
except ImportError as error:
    raise RuntimeError(
        "The package management software service failed to start : %s" %
        error) from error
else:
    from packageship.application.appglobal import permissions
    from packageship.libs.conf import configuration


@app.before_request
def before_request():
    """
    Description: Global request interception
    """
    if not permissions():