diff --git a/synapsepy/__init__.py b/synapsepy/__init__.py index c613dcc..7bcef9c 100644 --- a/synapsepy/__init__.py +++ b/synapsepy/__init__.py @@ -1,6 +1,2 @@ -from .client import Client -from .user import User, Users -from .node import Node, Nodes -from .subnet import Subnet, Subnets -from .subscription import Subscription, Subscriptions -from .transaction import Trans, Transactions \ No newline at end of file +from .lib.client import Client +from .lib.user import User, Users \ No newline at end of file diff --git a/synapsepy/endpoints.py b/synapsepy/constants/endpoints.py similarity index 100% rename from synapsepy/endpoints.py rename to synapsepy/constants/endpoints.py diff --git a/synapsepy/errors.py b/synapsepy/helpers/errors.py similarity index 100% rename from synapsepy/errors.py rename to synapsepy/helpers/errors.py diff --git a/synapsepy/http_client.py b/synapsepy/helpers/http_client.py similarity index 100% rename from synapsepy/http_client.py rename to synapsepy/helpers/http_client.py diff --git a/synapsepy/node.py b/synapsepy/helpers/node.py similarity index 100% rename from synapsepy/node.py rename to synapsepy/helpers/node.py diff --git a/synapsepy/subnet.py b/synapsepy/helpers/subnet.py similarity index 100% rename from synapsepy/subnet.py rename to synapsepy/helpers/subnet.py diff --git a/synapsepy/subscription.py b/synapsepy/helpers/subscription.py similarity index 100% rename from synapsepy/subscription.py rename to synapsepy/helpers/subscription.py diff --git a/synapsepy/transaction.py b/synapsepy/helpers/transaction.py similarity index 100% rename from synapsepy/transaction.py rename to synapsepy/helpers/transaction.py diff --git a/synapsepy/client.py b/synapsepy/lib/client.py similarity index 97% rename from synapsepy/client.py rename to synapsepy/lib/client.py index bac1d34..da21818 100644 --- a/synapsepy/client.py +++ b/synapsepy/lib/client.py @@ -1,13 +1,13 @@ -from .http_client import HttpClient +from ..helpers.http_client import HttpClient from .user import User, Users -from .node import Node, Nodes -from .transaction import Trans, Transactions -from .subscription import Subscription, Subscriptions -from . import errors as api_errors +from ..helpers.node import Node, Nodes +from ..helpers.transaction import Trans, Transactions +from ..helpers.subscription import Subscription, Subscriptions +from ..helpers import errors as api_errors -from .endpoints import paths +from ..constants.endpoints import paths import sys import json diff --git a/synapsepy/user.py b/synapsepy/lib/user.py similarity index 99% rename from synapsepy/user.py rename to synapsepy/lib/user.py index 807b88c..d271570 100644 --- a/synapsepy/user.py +++ b/synapsepy/lib/user.py @@ -1,9 +1,9 @@ -from .endpoints import paths +from ..constants.endpoints import paths -from .node import Node, Nodes -from .subnet import Subnet, Subnets -from .transaction import Trans, Transactions +from ..helpers.node import Node, Nodes +from ..helpers.subnet import Subnet, Subnets +from ..helpers.transaction import Trans, Transactions from functools import partial @@ -11,7 +11,7 @@ import logging import requests import warnings -from . import errors as api_errors +from ..helpers import errors as api_errors class User(): """ User Record diff --git a/synapsepy/tests/client_tests.py b/synapsepy/tests/client_tests.py index c574af0..d0b4d2f 100644 --- a/synapsepy/tests/client_tests.py +++ b/synapsepy/tests/client_tests.py @@ -1,16 +1,16 @@ import unittest from unittest import TestCase, mock -from .. import errors as api_errors +from ..helpers import errors as api_errors from .fixtures.user_fixtures import simple_response, users_resp from .fixtures.subscription_fixtures import subs_resp, subss_resp from .fixtures.node_fixtures import get_nodes_response -from ..client import Client -from ..user import User, Users -from ..node import Node, Nodes -from ..subscription import Subscription, Subscriptions +from ..lib.client import Client +from ..lib.user import User, Users +from ..helpers.node import Node, Nodes +from ..helpers.subscription import Subscription, Subscriptions class ClientTests(TestCase): ''' @@ -32,7 +32,7 @@ def test_client_init(self): self.assertIsInstance(self.client, Client) @mock.patch( - 'synapsepy.http_client.HttpClient.post', + 'synapsepy.helpers.http_client.HttpClient.post', return_value = simple_response, autospec = True ) @@ -42,7 +42,7 @@ def test_create_user(self, mock_request): self.assertIsInstance(simple, User) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = simple_response, autospec = True ) @@ -52,7 +52,7 @@ def test_get_user(self, mock_request): self.assertIsInstance(simple, User) @mock.patch( - 'synapsepy.http_client.HttpClient.post', + 'synapsepy.helpers.http_client.HttpClient.post', return_value = subs_resp, autospec = True ) @@ -62,7 +62,7 @@ def test_create_subs(self, mock_request): self.assertIsInstance(sub, Subscription) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = subs_resp, autospec = True ) @@ -71,7 +71,7 @@ def test_get_subs(self, mock_request): self.assertIsInstance(subs, Subscription) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) @@ -80,7 +80,7 @@ def test_webhook_logs(self, mock_request): self.assertIsInstance(logs, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) @@ -89,7 +89,7 @@ def test_crypto_quotes(self, mock_request): self.assertIsInstance(response, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) @@ -98,7 +98,7 @@ def test_crypto_market_data(self, mock_request): self.assertIsInstance(response, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) @@ -107,7 +107,7 @@ def test_trade_market_data(self, mock_request): self.assertIsInstance(response, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) @@ -116,7 +116,7 @@ def test_locate_atms(self, mock_request): self.assertIsInstance(response, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {'public_key_obj':{}}, autospec = True ) @@ -126,7 +126,7 @@ def test_issue_pub_key(self, mock_request): self.assertIsInstance(key, dict) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = users_resp, autospec = True ) @@ -136,7 +136,7 @@ def test_get_users(self, mock_request): self.assertIsInstance(users, Users) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = subss_resp, autospec = True ) @@ -146,7 +146,7 @@ def test_get_subss(self, mock_request): self.assertIsInstance(subss, Subscriptions) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = get_nodes_response, autospec = True ) @@ -156,7 +156,7 @@ def test_get_nodes(self, mock_request): self.assertIsInstance(nodes, Nodes) @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value = {}, autospec = True ) diff --git a/synapsepy/tests/error_tests.py b/synapsepy/tests/error_tests.py index c764a03..4784cb0 100644 --- a/synapsepy/tests/error_tests.py +++ b/synapsepy/tests/error_tests.py @@ -1,8 +1,8 @@ import unittest -from ..client import Client -from .. import errors as api_errors +from ..lib.client import Client +from ..helpers import errors as api_errors from .fixtures.error_fixtures import * class ErrorTests(unittest.TestCase): diff --git a/synapsepy/tests/user_tests.py b/synapsepy/tests/user_tests.py index 40209bc..0a2ef14 100644 --- a/synapsepy/tests/user_tests.py +++ b/synapsepy/tests/user_tests.py @@ -7,16 +7,16 @@ from .fixtures.trans_fixtures import * from .fixtures.subnet_fixtures import * -from ..client import Client -from ..user import User -from ..node import Node, Nodes -from ..transaction import Trans, Transactions -from ..subnet import Subnet, Subnets +from ..lib.client import Client +from ..lib.user import User +from ..helpers.node import Node, Nodes +from ..helpers.transaction import Trans, Transactions +from ..helpers.subnet import Subnet, Subnets -from ..http_client import HttpClient +from ..helpers.http_client import HttpClient @mock.patch( - 'synapsepy.user.User._do_request', + 'synapsepy.lib.user.User._do_request', return_value={}, autospec=True ) @@ -58,7 +58,7 @@ def setUp(self): self.node_trans_count = get_all_trans_resp['trans_count'] @mock.patch( - 'synapsepy.http_client.HttpClient.get', + 'synapsepy.helpers.http_client.HttpClient.get', return_value={'refresh_token':'1234'}, autospec=True ) @@ -69,7 +69,7 @@ def test_refresh(self, mock_get, mock_request): ) @mock.patch( - 'synapsepy.http_client.HttpClient.post', + 'synapsepy.helpers.http_client.HttpClient.post', return_value={'oauth_key':'1234'}, autospec=True )