• Jérome Perrin's avatar
    testXHTML: test portal types also from tools · b1f4cbe4
    Jérome Perrin authored
    Some portal types such as Business Template were not tested by testXHTML
    because this tests started by modules and recursively tests views based
    on allowed content types. Because of this approach, types that are not
    created in a module but in a tool were never tested.
    
    With unittest, the only way to dynamically add test methods to a class
    is to generate a test class in test_suite function. At this stage, the
    ERP5 site is not created yet, so the test had to introspects business
    templates XML.
    
    This now uses a slightly different approach, instead of finding modules
    and chain of allowed content types from business template XML, we only
    use business template to introspect the list of actions.
    The lookup of the appropriate containers is no longer done before setup
    by static analysis of business templates XML, but later once the site is
    created, by dynamic analysis of the modules and allowed content types on
    the running ERP5 site during the test method.
    If we don't find a chain of portal types, we create the test document in
    portal_trash, a tool without filter of content types.
    
    This way, we can test all views of all portal types. This revealed a few
    problems:
     - we need developer role to create components in portal_components, for
    this we add developer role to the current user.
     - Delivery Cell portal type looks not used, there are no container
    accepting it. We don't test delivery cell views for this reason.
     - VCS view on business template needs preferences and working copy
    setup. We just mark this test as expected failure for now.
     - Solver Decision has a form conditionnaly displayed when there's a
    relation to a solver, but this test does not evaluate action conditions
    and does not allow to call a script (that would made it possible to
    modify the document so that the condition is true). For now we also
    mark this as expected failure.
    b1f4cbe4
testXHTML.py 31.4 KB