web/test/test_windmill.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 05 Jul 2010 18:00:33 +0200
changeset 5890 141b935a38fc
parent 5675 4535f8e57580
child 5995 b9c612274af7
permissions -rw-r--r--
backport stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5675
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     1
from cubicweb.devtools import cwwindmill
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     2
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     3
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     4
class CubicWebWindmillUseCase(cwwindmill.CubicWebWindmillUseCase):
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     5
    """class for windmill use case tests
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     6
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     7
    From test server parameters:
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     8
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
     9
    :params ports_range: range of http ports to test (range(7000, 8000) by default)
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    10
    :type ports_range: iterable
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    11
    :param anonymous_logged: is anonymous user logged by default ?
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    12
    :type anonymous_logged: bool
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    13
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    14
    The first port found as available in `ports_range` will be used to launch
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    15
    the test server
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    16
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    17
    From Windmill configuration:
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    18
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    19
    :param browser: browser identification string (firefox|ie|safari|chrome) (firefox by default)
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    20
    :param test_dir: testing file path or directory (./windmill by default)
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    21
    """
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    22
    #ports_range = range(7000, 8000)
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    23
    anonymous_logged = False
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    24
    #browser = 'firefox'
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    25
    #test_dir = osp.join(os.getcwd(), 'windmill')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    26
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    27
    # If you prefer, you can put here the use cases recorded by windmill GUI
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    28
    # (services transformer) instead of the windmill sub-directory
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    29
    # You can change `test_dir` as following:
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    30
    #test_dir = __file__
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    31
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    32
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    33
from windmill.authoring import WindmillTestClient
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    34
def test_usecase():
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    35
    client = WindmillTestClient(__name__)
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    36
    import pdb; pdb.set_trace()
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    37
    client.open(url=u'/')
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    38
#    ...
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    39
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    40
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    41
if __name__ == '__main__':
4535f8e57580 [web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff changeset
    42
    cwwindmill.unittest_main()