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)
Пример #2
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)
Пример #3
0
def get_property_type_by_property_name(connection):
    property_definitions = get_all_properties(connection)
    property_type_by_property_name = \
        {p.name: type(p) for p in property_definitions}
    return property_type_by_property_name
Пример #4
0
 def test_unsupported_type(self):
     api_calls_simulator = _simulate_get_all_properties_with_unsupported_type
     with assert_raises(MultipleInvalid):
         with MockPortalConnection(api_calls_simulator) as connection:
             get_all_properties(connection)
Пример #5
0
    def _check_properties_retrieval(self, properties):
        api_calls_simulator = GetAllProperties(properties)
        with MockPortalConnection(api_calls_simulator) as connection:
            retrieved_properties = get_all_properties(connection)

        eq_(list(properties), list(retrieved_properties))
Пример #6
0
 def test_unsupported_type(self):
     api_calls_simulator = _simulate_get_all_properties_with_unsupported_type
     with assert_raises(MultipleInvalid):
         with MockPortalConnection(api_calls_simulator) as connection:
             get_all_properties(connection)
Пример #7
0
    def _check_properties_retrieval(self, properties):
        api_calls_simulator = GetAllProperties(properties)
        with MockPortalConnection(api_calls_simulator) as connection:
            retrieved_properties = get_all_properties(connection)

        eq_(list(properties), list(retrieved_properties))
Пример #8
0
def get_property_type_by_property_name(connection):
    property_definitions = get_all_properties(connection)
    property_type_by_property_name = \
        {p.name: type(p) for p in property_definitions}
    return property_type_by_property_name