Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions synapsepy/__init__.py
Original file line number Diff line number Diff line change
@@ -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
from .lib.client import Client
from .lib.user import User, Users
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions synapsepy/client.py → synapsepy/lib/client.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions synapsepy/user.py → synapsepy/lib/user.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

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

import json
import logging
import requests
import warnings
from . import errors as api_errors
from ..helpers import errors as api_errors

class User():
""" User Record
Expand Down
38 changes: 19 additions & 19 deletions synapsepy/tests/client_tests.py
Original file line number Diff line number Diff line change
@@ -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):
'''
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions synapsepy/tests/error_tests.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
18 changes: 9 additions & 9 deletions synapsepy/tests/user_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down