Skip to content

Commit

Permalink
version bump for release
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetrucciani committed Aug 15, 2019
1 parent ebc2469 commit f94a610
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 47 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ term_report = --cov-report term
xml_report = --cov-report xml
reports = $(html_report) $(term_report) $(xml_report)
target = --target-version py34
MAKEFLAGS = --silent --ignore-errors --no-print-directory


all: test_all
Expand Down
7 changes: 5 additions & 2 deletions hubspot3/ecommerce_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,8 @@ def check_sync_status_for_object(
Get the synchronization status of a object by its external ID.
:see: https://developers.hubspot.com/docs/methods/ecommerce/v2/check-sync-status
"""
return self._call("sync/status/{}/{}/{}".format(store_id, object_type, external_object_id),
method="GET", **options)
return self._call(
"sync/status/{}/{}/{}".format(store_id, object_type, external_object_id),
method="GET",
**options
)
2 changes: 1 addition & 1 deletion hubspot3/globals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
globals file for hubspot3
"""
__version__ = "3.2.26"
__version__ = "3.2.27"

BASE_URL = "https://api.hubapi.com"

Expand Down
2 changes: 1 addition & 1 deletion hubspot3/test/test_deals.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_delete_deal():
]
}
response_data = DEALS.create(data)
deal_id = response_data['dealId']
deal_id = response_data["dealId"]
DEALS.delete(deal_id)
with pytest.raises(HubspotNotFound):
DEALS.get(deal_id)
Expand Down
64 changes: 36 additions & 28 deletions hubspot3/test/test_ecommerce_bridge.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import json

from unittest.mock import Mock, patch
import pytest

from unittest.mock import Mock, patch
from hubspot3 import ecommerce_bridge
from hubspot3.error import HubspotBadConfig

Expand Down Expand Up @@ -360,39 +358,49 @@ def test_create_or_update_store(
assert result == response_data


@pytest.mark.parametrize("store_id, object_type, object_id, expected_data", [
(
"test-store",
"CONTACT",
"1234",
{
"storeId": "test-store",
"objectType": "CONTACT",
"externalObjectId": "1234"
}
),
(
"test-store",
"DEAL",
"5678",
{
"storeId": "test-store",
"objectType": "DEAL",
"externalObjectId": "5678"
}
)
])
def test_check_sync_status_for_object(ecommerce_bridge_client, mock_connection, store_id, object_type, object_id, expected_data):
@pytest.mark.parametrize(
"store_id, object_type, object_id, expected_data",
[
(
"test-store",
"CONTACT",
"1234",
{
"storeId": "test-store",
"objectType": "CONTACT",
"externalObjectId": "1234",
},
),
(
"test-store",
"DEAL",
"5678",
{"storeId": "test-store", "objectType": "DEAL", "externalObjectId": "5678"},
),
],
)
def test_check_sync_status_for_object(
ecommerce_bridge_client,
mock_connection,
store_id,
object_type,
object_id,
expected_data,
):
response_data = {
"storeId": store_id,
"objectType": object_type,
"externalObjectId": object_id,
}
mock_connection.set_response(200, json.dumps(response_data))
result = ecommerce_bridge_client.check_sync_status_for_object(object_type, object_id, store_id)
result = ecommerce_bridge_client.check_sync_status_for_object(
object_type, object_id, store_id
)
mock_connection.assert_num_requests(1)
mock_connection.assert_has_request(
"GET",
"/extensions/ecomm/v2/sync/status/{}/{}/{}?".format(store_id, object_type, object_id)
"/extensions/ecomm/v2/sync/status/{}/{}/{}?".format(
store_id, object_type, object_id
),
)
assert result == response_data
28 changes: 13 additions & 15 deletions hubspot3/test/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def lines_client(mock_connection):


class TestLinesClient(object):

@pytest.mark.parametrize("subpath, expected_value", [
("", "crm-objects/v1/objects/line_items/"),
("batch-create", "crm-objects/v1/objects/line_items/batch-create"),
("batch-read", "crm-objects/v1/objects/line_items/batch-read"),
])
@pytest.mark.parametrize(
"subpath, expected_value",
[
("", "crm-objects/v1/objects/line_items/"),
("batch-create", "crm-objects/v1/objects/line_items/batch-create"),
("batch-read", "crm-objects/v1/objects/line_items/batch-read"),
],
)
def test_get_path(self, lines_client, subpath, expected_value):
assert lines_client._get_path(subpath) == expected_value

Expand All @@ -32,10 +34,7 @@ def test_create(self, lines_client, mock_connection):
{"name": "name", "value": "Custom name for the line item"},
]
}
response_body = {
"objectType": "LINE_ITEM",
"objectId": "123456789",
}
response_body = {"objectType": "LINE_ITEM", "objectId": "123456789"}
mock_connection.set_response(200, json.dumps(response_body))
resp = lines_client.create(data)
mock_connection.assert_num_requests(1)
Expand All @@ -57,10 +56,7 @@ def test_delete(self, lines_client, mock_connection):

def test_get(self, lines_client, mock_connection):
line_item_id = "1234"
response_body = {
"objectType": "LINE_ITEM",
"objectId": "1234",
}
response_body = {"objectType": "LINE_ITEM", "objectId": "1234"}
mock_connection.set_response(200, json.dumps(response_body))
resp = lines_client.get(line_item_id)
mock_connection.assert_num_requests(1)
Expand All @@ -73,5 +69,7 @@ def test_get(self, lines_client, mock_connection):
def test_link_line_item_to_deal(self, mock_associations_client, lines_client):
mock_instance = mock_associations_client.return_value
lines_client.link_line_item_to_deal(1, 1)
mock_associations_client.assert_called_with(access_token=None, api_key=None, refresh_token=None)
mock_associations_client.assert_called_with(
access_token=None, api_key=None, refresh_token=None
)
mock_instance.link_line_item_to_deal.assert_called_with(1, 1)

0 comments on commit f94a610

Please sign in to comment.