Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
caf5c040
Commit
caf5c040
authored
Apr 26, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding users to generated fixture data
parent
dfc17496
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
fixtures/anonymize_fixtures.py
+50
-0
No files found.
fixtures/anonymize_fixtures.py
View file @
caf5c040
...
...
@@ -5,6 +5,52 @@ import copy
from
collections
import
defaultdict
from
argparse
import
ArgumentParser
,
FileType
def
generate_user
(
user_number
):
return
{
"pk"
:
user_number
,
"model"
:
"auth.user"
,
"fields"
:
{
"status"
:
"w"
,
"last_name"
:
"Last"
,
"gold"
:
0
,
"is_staff"
:
False
,
"user_permissions"
:
[],
"interesting_tags"
:
""
,
"email_key"
:
None
,
"date_joined"
:
"2012-04-26 11:36:39"
,
"first_name"
:
""
,
"email_isvalid"
:
False
,
"avatar_type"
:
"n"
,
"website"
:
""
,
"is_superuser"
:
False
,
"date_of_birth"
:
None
,
"last_login"
:
"2012-04-26 11:36:48"
,
"location"
:
""
,
"new_response_count"
:
0
,
"email"
:
"user{num}@example.com"
.
format
(
num
=
user_number
),
"username"
:
"user{num}"
.
format
(
num
=
user_number
),
"is_active"
:
True
,
"consecutive_days_visit_count"
:
0
,
"email_tag_filter_strategy"
:
1
,
"groups"
:
[],
"password"
:
"sha1$90e6f$562a1d783a0c47ce06ebf96b8c58123a0671bbf0"
,
"silver"
:
0
,
"bronze"
:
0
,
"questions_per_page"
:
10
,
"about"
:
""
,
"show_country"
:
True
,
"country"
:
""
,
"display_tag_filter_strategy"
:
0
,
"seen_response_count"
:
0
,
"real_name"
:
""
,
"ignored_tags"
:
""
,
"reputation"
:
1
,
"gravatar"
:
"366d981a10116969c568a18ee090f44c"
,
"last_seen"
:
"2012-04-26 11:36:39"
}
}
def
parse_args
(
args
=
sys
.
argv
[
1
:]):
parser
=
ArgumentParser
()
...
...
@@ -37,7 +83,11 @@ def main(args=sys.argv[1:]):
out_pk
+=
1
out_data
.
append
(
data
)
for
student_id
in
xrange
(
args
.
count
):
out_data
.
append
(
generate_user
(
student_id
))
json
.
dump
(
out_data
,
args
.
output
,
indent
=
2
)
if
__name__
==
"__main__"
:
sys
.
exit
(
main
())
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