~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/browser/tests/test_views.py

  • Committer: Curtis Hovey
  • Date: 2009-07-06 21:11:19 UTC
  • mto: This revision was merged to the branch mainline in revision 8802.
  • Revision ID: curtis.hovey@canonical.com-20090706211119-ncb9aogoxwvk3w07
Added base-layout for the new page designs. It provides for layouts, each tested, and the test files provide starting points for new templates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2009 Canonical Ltd.  All rights reserved.
 
2
"""
 
3
Run the view tests.
 
4
"""
 
5
 
 
6
import logging
 
7
import os
 
8
import unittest
 
9
 
 
10
from canonical.launchpad.testing.systemdocs import (
 
11
    LayeredDocFileSuite, setUp, tearDown)
 
12
from canonical.testing import (
 
13
    DatabaseFunctionalLayer, LaunchpadFunctionalLayer)
 
14
 
 
15
 
 
16
here = os.path.dirname(os.path.realpath(__file__))
 
17
 
 
18
# The default layer of view tests is the DatabaseFunctionalLayer. Tests
 
19
# that require something special like the librarian or mailman must run
 
20
# on a layer that sets those services up.
 
21
special_test_layer = {}
 
22
 
 
23
 
 
24
def test_suite():
 
25
    suite = unittest.TestSuite()
 
26
    testsdir = os.path.abspath(here)
 
27
 
 
28
    # Add tests using default setup/teardown
 
29
    filenames = [filename
 
30
                 for filename in os.listdir(testsdir)
 
31
                 if filename.endswith('.txt')]
 
32
    # Sort the list to give a predictable order.
 
33
    filenames.sort()
 
34
    for filename in filenames:
 
35
        path = filename
 
36
        if path in special_test_layer:
 
37
            layer = special_test_layer[path]
 
38
        else:
 
39
            layer = DatabaseFunctionalLayer
 
40
        one_test = LayeredDocFileSuite(
 
41
            path, setUp=setUp, tearDown=tearDown, layer=layer,
 
42
            stdout_logging_level=logging.WARNING
 
43
            )
 
44
        suite.addTest(one_test)
 
45
 
 
46
    return suite