Skip to content

Commit

Permalink
Added response data maker for property deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoruiz committed Apr 10, 2014
1 parent 10cdf20 commit b3e9cee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions hubspot/contacts/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,6 @@ def _format_data_for_property_group(property_group):
def _format_data_for_properties(properties):
properties_data = [format_data_for_property(p) for p in properties]
return properties_data


PROPERTY_DELETION_RESPONSE_DATA_MAKER = NULL_RESPONSE_DATA_MAKER
14 changes: 8 additions & 6 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
#
##############################################################################

from nose.tools import assert_in
from nose.tools import assert_raises
from nose.tools import eq_

from voluptuous import MultipleInvalid
from hubspot.connection.exc import HubspotClientError
from hubspot.connection.testing import ConstantResponseDataMaker
from hubspot.connection.testing import MockPortalConnection
from hubspot.connection.testing import RemoteMethod
from nose.tools import assert_in
from nose.tools import assert_raises
from nose.tools import eq_
from voluptuous import MultipleInvalid

from hubspot.contacts.generic_utils import get_uuid4_str
from hubspot.contacts.properties import BooleanProperty
Expand All @@ -37,6 +36,7 @@
from hubspot.contacts.request_data_formatters.properties import \
format_data_for_property
from hubspot.contacts.testing import AllPropertiesRetrievalResponseDataMaker
from hubspot.contacts.testing import PROPERTY_DELETION_RESPONSE_DATA_MAKER
from hubspot.contacts.testing import PropertyCreationRetrievalResponseDataMaker

from tests.utils import BaseMethodTestCase
Expand Down Expand Up @@ -223,7 +223,9 @@ class TestPropertyDeletion(BaseMethodTestCase):
_REMOTE_METHOD = RemoteMethod('/properties/' + _PROPERTY_NAME, 'DELETE')

def test_existing_mutable_property(self):
connection = MockPortalConnection()
connection = MockPortalConnection({
self._REMOTE_METHOD: PROPERTY_DELETION_RESPONSE_DATA_MAKER,
})
delete_property(self._PROPERTY_NAME, connection)

self._assert_expected_remote_method_used(connection)
Expand Down

0 comments on commit b3e9cee

Please sign in to comment.