cubicweb/test/data/entities.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Sat, 16 Jan 2016 13:48:51 +0100
changeset 11057 0b59724cb3f2
parent 10529 test/data/entities.py@747eded13c68
permissions -rw-r--r--
Reorganize source tree to have a "cubicweb" top-level package Basically: mkdir cubicweb hg mv *.py -X setup.py cubicweb hg mv dataimport devtools entities etwist ext hooks i18n misc schemas server skeleton sobjects test web wsgi cubicweb Other changes: * adjust path to cubicweb-ctl in devtools tests * update setup.py to avoid importing __pkginfo__ (exec it instead), replace os.path.walk by os.walk and prepend `modname` here and there * update tox.ini to account for new test locations * update doc/conf.py so that it still finds __pkginfo__.py and CWDIR in doc/Makefile
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7827
9bbf83f68bcc [entity] upgrade fetch_[unrelated_]order to benefit from changes introduced in 3.14 (closes #1942758)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     1
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1473
diff changeset
    18
10529
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    19
from cubicweb.entities import AnyEntity, fetch_config, adapters
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    20
from cubicweb.predicates import is_instance
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    21
744
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    22
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 744
diff changeset
    23
class Societe(AnyEntity):
3408
c92170fca813 [api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    24
    __regid__ = 'Societe'
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 744
diff changeset
    25
    fetch_attrs = ('nom',)
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 744
diff changeset
    26
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 744
diff changeset
    27
class Personne(Societe):
744
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    28
    """customized class forne Person entities"""
3408
c92170fca813 [api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    29
    __regid__ = 'Personne'
7827
9bbf83f68bcc [entity] upgrade fetch_[unrelated_]order to benefit from changes introduced in 3.14 (closes #1942758)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    30
    fetch_attrs, cw_fetch_order = fetch_config(['nom', 'prenom'])
744
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    31
    rest_attr = 'nom'
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    32
9214
be05b42b4825 Do not use cubicweb-card in rest_path tests
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 7827
diff changeset
    33
class Ami(Societe):
be05b42b4825 Do not use cubicweb-card in rest_path tests
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 7827
diff changeset
    34
    __regid__ = 'Ami'
be05b42b4825 Do not use cubicweb-card in rest_path tests
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 7827
diff changeset
    35
    rest_attr = 'nom'
744
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    36
4da6e0f4df2a test upgrade
sylvain.thenault@logilab.fr
parents:
diff changeset
    37
class Note(AnyEntity):
3408
c92170fca813 [api] use __regid__ instead of deprecated id
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1977
diff changeset
    38
    __regid__ = 'Note'
10529
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    39
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    40
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    41
class FakeFileIDownloadableAdapter(adapters.IDownloadableAdapter):
747eded13c68 [test] use FakeFile instead of File in test_fulltextindex
Julien Cristau <julien.cristau@logilab.fr>
parents: 9214
diff changeset
    42
    __select__ = is_instance('FakeFile')