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
d395c444
Commit
d395c444
authored
Jan 22, 2013
by
Brian Wilson
Committed by
Ashley Penney
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more pearson tests, and update commands in response
parent
740d0403
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
common/djangoapps/student/management/commands/pearson_export_cdd.py
+6
-3
common/djangoapps/student/management/commands/pearson_export_ead.py
+5
-3
common/djangoapps/student/management/commands/pearson_transfer.py
+7
-4
common/djangoapps/student/management/commands/tests/test_pearson.py
+0
-0
No files found.
common/djangoapps/student/management/commands/pearson_export_cdd.py
View file @
d395c444
...
...
@@ -5,7 +5,7 @@ from datetime import datetime
from
optparse
import
make_option
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
,
CommandError
from
student.models
import
TestCenterUser
...
...
@@ -39,6 +39,9 @@ class Command(BaseCommand):
(
"LastUpdate"
,
"user_updated_at"
),
# in UTC, so same as what we store
])
# define defaults, even thought 'store_true' shouldn't need them.
# (call_command will set None as default value for all options that don't have one,
# so one cannot rely on presence/absence of flags in that world.)
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'--dest-from-settings'
,
action
=
'store_true'
,
...
...
@@ -63,13 +66,13 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# used in the system.
if
'dest-from-settings'
in
options
:
if
'dest-from-settings'
in
options
and
options
[
'dest-from-settings'
]
:
if
'LOCAL_EXPORT'
in
settings
.
PEARSON
:
dest
=
settings
.
PEARSON
[
'LOCAL_EXPORT'
]
else
:
raise
CommandError
(
'--dest-from-settings was enabled but the'
'PEARSON[LOCAL_EXPORT] setting was not set.'
)
elif
'destination'
in
options
:
elif
'destination'
in
options
and
options
[
'destination'
]
:
dest
=
options
[
'destination'
]
else
:
raise
CommandError
(
'--destination or --dest-from-settings must be used'
)
...
...
common/djangoapps/student/management/commands/pearson_export_ead.py
View file @
d395c444
...
...
@@ -5,7 +5,7 @@ from datetime import datetime
from
optparse
import
make_option
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
,
CommandError
from
student.models
import
TestCenterRegistration
...
...
@@ -39,10 +39,12 @@ class Command(BaseCommand):
make_option
(
'--dump_all'
,
action
=
'store_true'
,
dest
=
'dump_all'
,
default
=
False
,
),
make_option
(
'--force_add'
,
action
=
'store_true'
,
dest
=
'force_add'
,
default
=
False
,
),
)
...
...
@@ -57,13 +59,13 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# used in the system.
if
'dest-from-settings'
in
options
:
if
'dest-from-settings'
in
options
and
options
[
'dest-from-settings'
]
:
if
'LOCAL_EXPORT'
in
settings
.
PEARSON
:
dest
=
settings
.
PEARSON
[
'LOCAL_EXPORT'
]
else
:
raise
CommandError
(
'--dest-from-settings was enabled but the'
'PEARSON[LOCAL_EXPORT] setting was not set.'
)
elif
'destination
s'
in
options
:
elif
'destination
'
in
options
and
options
[
'destination'
]
:
dest
=
options
[
'destination'
]
else
:
raise
CommandError
(
'--destination or --dest-from-settings must be used'
)
...
...
common/djangoapps/student/management/commands/pearson_transfer.py
View file @
d395c444
import
os
from
optparse
import
make_option
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management
import
call_command
from
dogapi
import
dog_http_api
,
dog_stats_api
import
paramiko
import
boto
import
os
dog_http_api
.
api_key
=
settings
.
DATADOG_API
...
...
@@ -13,7 +15,7 @@ class Command(BaseCommand):
help
=
"""
This command handles the importing and exporting of student records for
Pearson. It uses some other Django commands to export and import the
files and then uploads over SFTP to
p
earson and stuffs the entry in an
files and then uploads over SFTP to
P
earson and stuffs the entry in an
S3 bucket for archive purposes.
Usage: django-admin.py pearson-transfer --mode [import|export|both]
...
...
@@ -29,11 +31,12 @@ class Command(BaseCommand):
def
handle
(
self
,
**
options
):
# TODO: this doesn't work. Need to check if it's a property.
if
not
settings
.
PEARSON
:
raise
CommandError
(
'No PEARSON entries in auth/env.json.'
)
for
value
in
[
'LOCAL_IMPORT'
,
'SFTP_IMPORT'
,
'
BUCKET'
,
'
LOCAL_EXPORT'
,
'SFTP_EXPORT'
]:
for
value
in
[
'LOCAL_IMPORT'
,
'SFTP_IMPORT'
,
'LOCAL_EXPORT'
,
'SFTP_EXPORT'
,
'SFTP_HOSTNAME'
,
'SFTP_USERNAME'
,
'SFTP_PASSWORD'
]:
if
value
not
in
settings
.
PEARSON
:
raise
CommandError
(
'No entry in the PEARSON settings'
'(env/auth.json) for {0}'
.
format
(
value
))
...
...
common/djangoapps/student/management/commands/tests/test_pearson.py
View file @
d395c444
This diff is collapsed.
Click to expand it.
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