1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
18 """unit tests for module cubicweb.server.msplanner""" |
18 """unit tests for module cubicweb.server.msplanner""" |
19 |
19 |
20 from __future__ import with_statement |
20 from __future__ import with_statement |
21 |
21 |
22 from logilab.common.decorators import clear_cache |
22 from logilab.common.decorators import clear_cache |
23 |
|
24 from yams.buildobjs import RelationDefinition |
23 from yams.buildobjs import RelationDefinition |
25 from rql import BadRQLQuery |
24 from rql import BadRQLQuery |
26 |
25 |
27 from cubicweb.devtools import init_test_database |
26 from cubicweb.devtools import init_test_database |
28 from cubicweb.devtools.repotest import BasePlannerTC, test_plan |
27 from cubicweb.devtools.repotest import BasePlannerTC, test_plan |
41 from cubicweb.schema import ERQLExpression |
40 from cubicweb.schema import ERQLExpression |
42 from cubicweb.server.sources import AbstractSource |
41 from cubicweb.server.sources import AbstractSource |
43 from cubicweb.server.msplanner import MSPlanner, PartPlanInformation |
42 from cubicweb.server.msplanner import MSPlanner, PartPlanInformation |
44 |
43 |
45 class FakeUserROSource(AbstractSource): |
44 class FakeUserROSource(AbstractSource): |
46 uri = 'zzz' |
|
47 support_entities = {'CWUser': False} |
45 support_entities = {'CWUser': False} |
48 support_relations = {} |
46 support_relations = {} |
49 def syntax_tree_search(self, *args, **kwargs): |
47 def syntax_tree_search(self, *args, **kwargs): |
50 return [] |
48 return [] |
51 |
49 |
52 |
50 |
53 class FakeCardSource(AbstractSource): |
51 class FakeCardSource(AbstractSource): |
54 uri = 'ccc' |
|
55 support_entities = {'Card': True, 'Note': True, 'State': True} |
52 support_entities = {'Card': True, 'Note': True, 'State': True} |
56 support_relations = {'in_state': True, 'multisource_rel': True, 'multisource_inlined_rel': True, |
53 support_relations = {'in_state': True, 'multisource_rel': True, 'multisource_inlined_rel': True, |
57 'multisource_crossed_rel': True,} |
54 'multisource_crossed_rel': True,} |
58 dont_cross_relations = set(('fiche', 'state_of')) |
55 dont_cross_relations = set(('fiche', 'state_of')) |
59 cross_relations = set(('multisource_crossed_rel',)) |
56 cross_relations = set(('multisource_crossed_rel',)) |