forked from nuxeo/FunkLoad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFacesScriptTestCase.tpl
More file actions
64 lines (53 loc) · 2.15 KB
/
Copy pathMyFacesScriptTestCase.tpl
File metadata and controls
64 lines (53 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: iso-8859-15 -*-
"""%(test_name)s FunkLoad test
$Id: $
"""
import unittest
from funkload.FunkLoadTestCase import FunkLoadTestCase
from webunit.utility import Upload
from funkload.utils import Data
#from funkload.utils import xmlrpc_get_credential
class %(class_name)s(FunkLoadTestCase):
"""XXX
This test uses the configuration file %(class_name)s.conf.
"""
MYFACES_STATE = 'org.apache.myfaces.trinidad.faces.STATE'
MYFACES_FORM = 'org.apache.myfaces.trinidad.faces.FORM'
MYFACES_TAG = '<input type="hidden" name="org.apache.myfaces.trinidad.faces.STATE" value="'
def myfacesParams(self, params, form=None):
"""Add MyFaces states to the params."""
html = self.getBody()
tag = self.MYFACES_TAG
start = html.find(tag) + len(tag)
end = html.find('"', start)
if start < 0 or end < 0:
raise ValueError('No MyFaces STATE found in the previous page.')
state = html[start:end]
params.insert(
0, [self.MYFACES_STATE, state])
if form:
params.insert(
0, [self.MYFACES_FORM, form])
return params
def setUp(self):
"""Setting up test."""
self.logd("setUp")
self.server_url = self.conf_get('main', 'url')
# XXX here you can setup the credential access like this
# credential_host = self.conf_get('credential', 'host')
# credential_port = self.conf_getInt('credential', 'port')
# self.login, self.password = xmlrpc_get_credential(credential_host,
# credential_port,
# XXX replace with a valid group
# 'members')
def test_%(test_name)s(self):
# The description should be set in the configuration file
server_url = self.server_url
# begin of test ---------------------------------------------
%(script)s
# end of test -----------------------------------------------
def tearDown(self):
"""Setting up test."""
self.logd("tearDown.\n")
if __name__ in ('main', '__main__'):
unittest.main()