def test_unsuccessful_creation(self): property_group = PropertyGroup(self._PROPERTY_GROUP_NAME) exception = HubspotClientError('Whoops!', get_uuid4_str()) simulator = UnsuccessfulCreatePropertyGroup(property_group, exception) with assert_raises_regexp(HubspotClientError, str(exception)): with MockPortalConnection(simulator) as connection: create_property_group(property_group, connection)
def test_property_groups(): with _get_portal_connection() as connection: property_group_to_create = PropertyGroup('propertygrouptest') created_property_group = \ create_property_group(property_group_to_create, connection) eq_(property_group_to_create.name, created_property_group.name) all_property_groups = get_all_property_groups(connection) assert_in(created_property_group, all_property_groups) delete_property_group(created_property_group.name, connection) all_property_groups = get_all_property_groups(connection) assert_not_in(created_property_group, all_property_groups)
def _create_property_group(property_group): simulator = CreatePropertyGroup(property_group) with MockPortalConnection(simulator) as connection: created_property_group = \ create_property_group(property_group, connection) return created_property_group