Skip to content

Commit

Permalink
Restore tabpy_tools and tabpy_server names
Browse files Browse the repository at this point in the history
  • Loading branch information
Olek Golovatyi committed Jul 27, 2020
1 parent 68aba48 commit d176fba
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 59 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
- [Documentation Updates](#documentation-updates)
- [TabPy with Swagger](#tabpy-with-swagger)
- [Code styling](#code-styling)
- [Publishing TabPy Package](#publishing-tabpy-package)

<!-- tocstop -->

Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ you may want to consider the following as you use TabPy:
- The REST server and Python execution share the same Python session,
meaning that HTTP requests and user scripts are evaluated in the
same addressable memory and processor threads.
- The tabpy.tools client does not perform client-side validation of the
- The tabpy.tabpy_tools client does not perform client-side validation of the
SSL certificate on TabPy Server.
- Python scripts can contain code which can harm security on the server
where the TabPy is running. For example, Python scripts can:
Expand Down
6 changes: 3 additions & 3 deletions docs/tabpy-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ to specify the service location for all subsequent operations:

```python

from tabpy.tools.client import Client
from tabpy.tabpy_tools.client import Client

client = Client('http://localhost:9004/')

Expand Down Expand Up @@ -351,7 +351,7 @@ method provided in this tools package:

```python

from tabpy.tools.schema import generate_schema
from tabpy.tabpy_tools.schema import generate_schema

schema = generate_schema(
input={'x': 3, 'y': 2},
Expand All @@ -368,7 +368,7 @@ To describe more complex input, like arrays, you would use the following syntax:

```python

from tabpy.tools.schema import generate_schema
from tabpy.tabpy_tools.schema import generate_schema

schema = generate_schema(
input={'x': [6.35, 6.40, 6.65, 8.60],
Expand Down
4 changes: 2 additions & 2 deletions tabpy/models/utils/setup_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import getpass
import os
import sys
from tabpy.tools.client import Client
from tabpy.tabpy_tools.client import Client


def get_default_config_file_path():
import tabpy

pkg_path = os.path.dirname(tabpy.__file__)
config_file_path = os.path.join(pkg_path, "server", "common", "default.conf")
config_file_path = os.path.join(pkg_path, "tabpy_server", "common", "default.conf")
return config_file_path


Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main():
args = docopt.docopt(__doc__)
config = args["--config"] or None

from tabpy.server.app.app import TabPyApp
from tabpy.tabpy_server.app.app import TabPyApp

app = TabPyApp(config)
app.run()
Expand Down
4 changes: 2 additions & 2 deletions tabpy/utils/tabpy_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import docopt
import logging
import secrets
from tabpy.server.app.util import parse_pwd_file
from tabpy.server.handlers.util import hash_password
from tabpy.tabpy_server.app.util import parse_pwd_file
from tabpy.tabpy_server.handlers.util import hash_password

logger = logging.getLogger(__name__)

Expand Down
66 changes: 33 additions & 33 deletions tests/unit/server_tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import unittest
from tempfile import NamedTemporaryFile
import tabpy
from tabpy.server.app.util import validate_cert
from tabpy.server.app.app import TabPyApp
from tabpy.tabpy_server.app.util import validate_cert
from tabpy.tabpy_server.app.app import TabPyApp

from unittest.mock import patch

Expand All @@ -22,11 +22,11 @@ def test_config_file_does_not_exist(self):
self.assertEqual(app.settings["log_request_context"], False)
self.assertEqual(app.settings["evaluate_timeout"], 30)

@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.PythonServiceHandler")
@patch("tabpy.server.app.app.os.path.exists", return_value=True)
@patch("tabpy.server.app.app.os")
@patch("tabpy.tabpy_server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.PythonServiceHandler")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=True)
@patch("tabpy.tabpy_server.app.app.os")
def test_no_config_file(
self,
mock_os,
Expand All @@ -37,7 +37,7 @@ def test_no_config_file(
):
pkg_path = os.path.dirname(tabpy.__file__)
obj_path = os.path.join(pkg_path, "tmp", "query_objects")
state_path = os.path.join(pkg_path, "server")
state_path = os.path.join(pkg_path, "tabpy_server")
mock_os.environ = {
"TABPY_PORT": "9004",
"TABPY_QUERY_OBJECT_PATH": obj_path,
Expand All @@ -52,11 +52,11 @@ def test_no_config_file(
self.assertTrue(len(mock_management_util.mock_calls) > 0)
mock_os.makedirs.assert_not_called()

@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.PythonServiceHandler")
@patch("tabpy.server.app.app.os.path.exists", return_value=False)
@patch("tabpy.server.app.app.os")
@patch("tabpy.tabpy_server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.PythonServiceHandler")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=False)
@patch("tabpy.tabpy_server.app.app.os")
def test_no_state_ini_file_or_state_dir(
self,
mock_os,
Expand All @@ -77,11 +77,11 @@ def tearDown(self):
os.remove(self.config_file.name)
self.config_file = None

@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.PythonServiceHandler")
@patch("tabpy.server.app.app.os.path.exists", return_value=True)
@patch("tabpy.server.app.app.os")
@patch("tabpy.tabpy_server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.PythonServiceHandler")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=True)
@patch("tabpy.tabpy_server.app.app.os")
def test_config_file_present(
self,
mock_os,
Expand Down Expand Up @@ -116,9 +116,9 @@ def test_config_file_present(
self.assertEqual(app.settings["log_request_context"], False)
self.assertEqual(app.settings["evaluate_timeout"], 30)

@patch("tabpy.server.app.app.os.path.exists", return_value=True)
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=True)
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.TabPyState")
def test_custom_evaluate_timeout_valid(
self, mock_state, mock_get_state_from_file, mock_path_exists
):
Expand All @@ -130,9 +130,9 @@ def test_custom_evaluate_timeout_valid(
app = TabPyApp(self.config_file.name)
self.assertEqual(app.settings["evaluate_timeout"], 1996.0)

@patch("tabpy.server.app.app.os.path.exists", return_value=True)
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=True)
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.TabPyState")
def test_custom_evaluate_timeout_invalid(
self, mock_state, mock_get_state_from_file, mock_path_exists
):
Expand All @@ -146,10 +146,10 @@ def test_custom_evaluate_timeout_invalid(
with self.assertRaises(ValueError):
TabPyApp(self.config_file.name)

@patch("tabpy.server.app.app.os")
@patch("tabpy.server.app.app.os.path.exists", return_value=True)
@patch("tabpy.server.app.app._get_state_from_file")
@patch("tabpy.server.app.app.TabPyState")
@patch("tabpy.tabpy_server.app.app.os")
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=True)
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
@patch("tabpy.tabpy_server.app.app.TabPyState")
def test_env_variables_in_config(
self, mock_state, mock_get_state, mock_path_exists, mock_os
):
Expand Down Expand Up @@ -234,7 +234,7 @@ def test_https_without_key(self):
"Error using HTTPS: The parameter(s) TABPY_KEY_FILE must be set."
)

@patch("tabpy.server.app.app.os.path")
@patch("tabpy.tabpy_server.app.app.os.path")
def test_https_cert_and_key_file_not_found(self, mock_path):
self.fp.write(
"[TabPy]\n"
Expand All @@ -251,7 +251,7 @@ def test_https_cert_and_key_file_not_found(self, mock_path):
"TABPY_KEY_FILE must point to an existing file."
)

@patch("tabpy.server.app.app.os.path")
@patch("tabpy.tabpy_server.app.app.os.path")
def test_https_cert_file_not_found(self, mock_path):
self.fp.write(
"[TabPy]\n"
Expand All @@ -270,7 +270,7 @@ def test_https_cert_file_not_found(self, mock_path):
"must point to an existing file."
)

@patch("tabpy.server.app.app.os.path")
@patch("tabpy.tabpy_server.app.app.os.path")
def test_https_key_file_not_found(self, mock_path):
self.fp.write(
"[TabPy]\n"
Expand All @@ -289,8 +289,8 @@ def test_https_key_file_not_found(self, mock_path):
"must point to an existing file."
)

@patch("tabpy.server.app.app.os.path.isfile", return_value=True)
@patch("tabpy.server.app.util.validate_cert")
@patch("tabpy.tabpy_server.app.app.os.path.isfile", return_value=True)
@patch("tabpy.tabpy_server.app.util.validate_cert")
def test_https_success(self, mock_isfile, mock_validate_cert):
self.fp.write(
"[TabPy]\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server_tests/test_endpoint_file_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from tabpy.server.common.endpoint_file_mgr import _check_endpoint_name
from tabpy.tabpy_server.common.endpoint_file_mgr import _check_endpoint_name


class TestEndpointFileManager(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/server_tests/test_endpoint_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import sys
import tempfile

from tabpy.server.app.app import TabPyApp
from tabpy.server.app.app import _init_asyncio_patch
from tabpy.server.handlers.util import hash_password
from tabpy.tabpy_server.app.app import TabPyApp
from tabpy.tabpy_server.app.app import _init_asyncio_patch
from tabpy.tabpy_server.handlers.util import hash_password
from tornado.testing import AsyncHTTPTestCase


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/server_tests/test_endpoints_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os
import tempfile

from tabpy.server.app.app import TabPyApp
from tabpy.server.handlers.util import hash_password
from tabpy.tabpy_server.app.app import TabPyApp
from tabpy.tabpy_server.handlers.util import hash_password
from tornado.testing import AsyncHTTPTestCase


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/server_tests/test_evaluation_plane_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import tempfile

from argparse import Namespace
from tabpy.server.app.app import TabPyApp
from tabpy.server.handlers.util import hash_password
from tabpy.tabpy_server.app.app import TabPyApp
from tabpy.tabpy_server.handlers.util import hash_password
from tornado.testing import AsyncHTTPTestCase


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server_tests/test_pwd_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
from tempfile import NamedTemporaryFile

from tabpy.server.app.app import TabPyApp
from tabpy.tabpy_server.app.app import TabPyApp


class TestPasswordFile(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/server_tests/test_service_info_handler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import base64
import json
import os
from tabpy.server.app.app import TabPyApp
from tabpy.server.app.SettingsParameters import SettingsParameters
from tabpy.tabpy_server.app.app import TabPyApp
from tabpy.tabpy_server.app.SettingsParameters import SettingsParameters
import tempfile
from tornado.testing import AsyncHTTPTestCase

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/tools_tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import unittest
from unittest.mock import Mock

from tabpy.tools.client import Client
from tabpy.tools.client import _check_endpoint_name
from tabpy.tabpy_tools.client import Client
from tabpy.tabpy_tools.client import _check_endpoint_name


class TestClient(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/tools_tests/test_rest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import requests
from requests.auth import HTTPBasicAuth
from tabpy.tools.rest import RequestsNetworkWrapper, ServiceClient
from tabpy.tabpy_tools.rest import RequestsNetworkWrapper, ServiceClient
import unittest
from unittest.mock import Mock

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/tools_tests/test_rest_object.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
import sys

from tabpy.tools.rest import RESTObject, RESTProperty, enum
from tabpy.tabpy_tools.rest import RESTObject, RESTProperty, enum


class TestRESTObject(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/tools_tests/test_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from tabpy.tools.schema import generate_schema
from tabpy.tabpy_tools.schema import generate_schema


class TestSchema(unittest.TestCase):
Expand Down

0 comments on commit d176fba

Please sign in to comment.