Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
13603d85
Commit
13603d85
authored
Sep 17, 2011
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix example following
fcb974e6
.
parent
23aa0d8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
erp5/util/testbrowser/examples/createERP5User.py
erp5/util/testbrowser/examples/createERP5User.py
+9
-4
No files found.
erp5/util/testbrowser/examples/createERP5User.py
View file @
13603d85
...
@@ -13,20 +13,22 @@ import sys
...
@@ -13,20 +13,22 @@ import sys
from
erp5.util.testbrowser.browser
import
Browser
from
erp5.util.testbrowser.browser
import
Browser
try
:
try
:
url
,
site_id
,
username
,
password
,
user_nbr
,
new_username_prefix
,
\
url
,
username
,
password
,
user_nbr
,
new_username_prefix
,
\
new_password
=
sys
.
argv
[
1
:]
new_password
=
sys
.
argv
[
1
:]
user_nbr
=
int
(
user_nbr
)
user_nbr
=
int
(
user_nbr
)
except
ValueError
:
except
ValueError
:
print
>>
sys
.
stderr
,
"ERROR: Missing arguments: %s URL
SITE_ID
USERNAME "
\
print
>>
sys
.
stderr
,
"ERROR: Missing arguments: %s URL USERNAME "
\
"PASSWORD NUMBER_OF_USERS NEW_USERNAME_PREFIX NEW_USERS_PASSWORD"
%
\
"PASSWORD NUMBER_OF_USERS NEW_USERNAME_PREFIX NEW_USERS_PASSWORD"
%
\
sys
.
argv
[
0
]
sys
.
argv
[
0
]
sys
.
exit
(
1
)
sys
.
exit
(
1
)
# Create a browser instance
# Create a browser instance
browser
=
Browser
(
url
,
site_id
,
username
=
username
,
password
=
password
)
browser
=
Browser
(
url
,
username
,
password
)
browser
.
open
()
browser
.
mainForm
.
submitLogin
()
erp5_role_tuple
=
(
'Assignee'
,
erp5_role_tuple
=
(
'Assignee'
,
'Assignor'
,
'Assignor'
,
...
@@ -41,12 +43,15 @@ erp5_role_tuple = ('Assignee',
...
@@ -41,12 +43,15 @@ erp5_role_tuple = ('Assignee',
post_data_format
=
"submit=Add&roles:list=Manager&roles:list=Owner&name="
\
post_data_format
=
"submit=Add&roles:list=Manager&roles:list=Owner&name="
\
"%(username)s&password=%(password)s&confirm=%(password)s"
"%(username)s&password=%(password)s&confirm=%(password)s"
# TODO: Because of post() not wrapped properly
zope_url
=
url
.
rsplit
(
'/'
,
2
)[
0
]
for
index
in
range
(
user_nbr
):
for
index
in
range
(
user_nbr
):
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
browser
.
open
(
'/acl_users/manage_users'
)
browser
.
open
(
'/acl_users/manage_users'
)
browser
.
post
(
'%s/acl_users/manage_users'
%
url
,
browser
.
post
(
'%s/acl_users/manage_users'
%
zope_
url
,
post_data_format
%
{
'username'
:
new_username
,
post_data_format
%
{
'username'
:
new_username
,
'password'
:
new_password
})
'password'
:
new_password
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment