Пример #1
0
 def test_unsuccessful_creation(self):
     error_message = 'Whoops!'
     exception = HubspotClientError(error_message, get_uuid4_str())
     simulator = UnsuccessfulCreateProperty(STUB_NUMBER_PROPERTY, exception)
     with assert_raises_regexp(HubspotClientError, error_message):
         with MockPortalConnection(simulator) as connection:
             create_property(STUB_NUMBER_PROPERTY, connection)
Пример #2
0
 def test_unsuccessful_creation(self):
     error_message = 'Whoops!'
     exception = HubspotClientError(error_message, get_uuid4_str())
     simulator = UnsuccessfulCreateProperty(STUB_NUMBER_PROPERTY, exception)
     with assert_raises_regexp(HubspotClientError, error_message):
         with MockPortalConnection(simulator) as connection:
             create_property(STUB_NUMBER_PROPERTY, connection)
Пример #3
0
 def create_hubspot_property(self):
     """
     To create the property called channel id to save the channel id of the
     caller to hubspot contacts
     """
     try:
         self.logger.debug('Inside create_hubspot_property() function')
         self.obtain_hubspot_config()
         self.authentication_key = APIKey(self.api_key)
         with PortalConnection(self.authentication_key,
                               self.app_name) as connection:
             property_ = NumberProperty(name='channelid',label=self.hubspot_property_label,\
             description='channel id of asterisk call',field_widget=u'text',\
             group_name=u'contactinformation')
             prop = create_property(property_, connection)
     except Exception as e:
         self.logger.exception(
             "Error while creating Hubspot property. {}".format(e.message))
def test_properties():
    with _get_portal_connection() as connection:
        all_property_groups = get_all_property_groups(connection)
        first_property_group = all_property_groups[0]
        property_to_create = StringProperty(
            'propertytest',
            'Property Test',
            'Just a test property',
            first_property_group.name,
            'text',
            )
        created_property = create_property(property_to_create, connection)
        eq_(property_to_create, created_property)

        all_properties = get_all_properties(connection)
        assert_in(created_property, all_properties)

        delete_property(created_property.name, connection)

        all_properties = get_all_properties(connection)
        assert_not_in(created_property, all_properties)
Пример #5
0
def test_properties():
    with _get_portal_connection() as connection:
        all_property_groups = get_all_property_groups(connection)
        first_property_group = all_property_groups[0]
        property_to_create = StringProperty(
            'propertytest',
            'Property Test',
            'Just a test property',
            first_property_group.name,
            'text',
        )
        created_property = create_property(property_to_create, connection)
        eq_(property_to_create, created_property)

        all_properties = get_all_properties(connection)
        assert_in(created_property, all_properties)

        delete_property(created_property.name, connection)

        all_properties = get_all_properties(connection)
        assert_not_in(created_property, all_properties)
Пример #6
0
    def _check_create_property(cls, property_, expected_property):
        simulator = CreateProperty(property_)
        with MockPortalConnection(simulator) as connection:
            created_property = create_property(property_, connection)

        eq_(expected_property, created_property)
Пример #7
0
    def _check_create_property(cls, property_, expected_property):
        simulator = CreateProperty(property_)
        with MockPortalConnection(simulator) as connection:
            created_property = create_property(property_, connection)

        eq_(expected_property, created_property)