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
5404345b
Commit
5404345b
authored
Jun 18, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tests pass when running on cms
parent
328b2df7
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
57 additions
and
64 deletions
+57
-64
cms/djangoapps/contentstore/management/commands/ftpserve.py
+0
-61
cms/envs/dev.py
+1
-1
cms/envs/test.py
+54
-0
common/djangoapps/cache_toolbox/COPYING
+0
-0
common/djangoapps/cache_toolbox/README.rst
+0
-0
common/djangoapps/cache_toolbox/__init__.py
+0
-0
common/djangoapps/cache_toolbox/app_settings.py
+0
-0
common/djangoapps/cache_toolbox/core.py
+0
-0
common/djangoapps/cache_toolbox/middleware.py
+0
-0
common/djangoapps/cache_toolbox/model.py
+0
-0
common/djangoapps/cache_toolbox/relation.py
+0
-0
common/djangoapps/cache_toolbox/templatetags/__init__.py
+0
-0
common/djangoapps/cache_toolbox/templatetags/cache_toolbox.py
+0
-0
common/djangoapps/util/__init__.py
+0
-0
common/djangoapps/util/cache.py
+0
-0
common/djangoapps/util/memcache.py
+0
-0
common/djangoapps/util/middleware.py
+0
-0
common/djangoapps/util/models.py
+0
-0
common/djangoapps/util/tests.py
+0
-0
common/djangoapps/util/views.py
+0
-0
common/lib/keystore/__init__.py
+0
-0
common/lib/keystore/django.py
+0
-0
common/lib/keystore/exceptions.py
+0
-0
common/lib/keystore/mongo.py
+0
-0
lms/envs/dev.py
+1
-1
rakefile
+1
-1
No files found.
cms/djangoapps/contentstore/management/commands/ftpserve.py
deleted
100644 → 0
View file @
328b2df7
from
django.core.management.base
import
BaseCommand
from
django.contrib.auth.models
import
User
import
contentstore.tasks
from
pyftpdlib
import
ftpserver
import
os
class
DjangoAuthorizer
(
object
):
def
validate_authentication
(
self
,
username
,
password
):
try
:
u
=
User
.
objects
.
get
(
username
=
username
)
except
User
.
DoesNotExist
:
return
False
# TODO: Check security groups
return
u
.
check_password
(
password
)
def
has_user
(
self
,
username
):
print
"????"
,
username
return
True
def
has_perm
(
self
,
username
,
perm
,
path
=
None
):
print
"!!!!!"
,
username
,
perm
,
path
return
True
def
get_home_dir
(
self
,
username
):
d
=
"/tmp/ftp/"
+
username
try
:
os
.
mkdir
(
d
)
except
OSError
:
pass
return
"/tmp/ftp/"
+
username
def
get_perms
(
self
,
username
):
return
'elradfmw'
def
get_msg_login
(
self
,
username
):
return
'Hello'
def
get_msg_quit
(
self
,
username
):
return
'Goodbye'
def
__init__
(
self
):
pass
def
impersonate_user
(
self
,
username
,
password
):
pass
def
terminate_impersonation
(
self
,
username
):
pass
def
on_upload
(
ftp_handler
,
filename
):
source
=
ftp_handler
.
remote_ip
author
=
ftp_handler
.
username
print
filename
,
author
,
source
# We pass on this for now:
# contentstore.tasks.on_upload
# It is a changing API, and it makes testing the FTP server slow.
class
Command
(
BaseCommand
):
help
=
\
''' Run FTP server.'''
def
handle
(
self
,
*
args
,
**
options
):
authorizer
=
DjangoAuthorizer
()
#ftpserver.DummyAuthorizer()
handler
=
ftpserver
.
FTPHandler
handler
.
on_file_received
=
on_upload
handler
.
authorizer
=
authorizer
address
=
(
"127.0.0.1"
,
2121
)
ftpd
=
ftpserver
.
FTPServer
(
address
,
handler
)
ftpd
.
serve_forever
()
cms/envs/dev.py
View file @
5404345b
...
...
@@ -38,6 +38,6 @@ CACHES = {
'BACKEND'
:
'django.core.cache.backends.dummy.DummyCache'
,
'KEY_PREFIX'
:
'general'
,
'VERSION'
:
4
,
'KEY_FUNCTION'
:
'util.
cache.memcache_
safe_key'
,
'KEY_FUNCTION'
:
'util.
memcache.
safe_key'
,
}
}
cms/envs/test.py
0 → 100644
View file @
5404345b
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/mitx # The location of this repo
/log # Where we're going to write log files
"""
from
.common
import
*
import
os
# Nose Test Runner
INSTALLED_APPS
+=
(
'django_nose'
,)
NOSE_ARGS
=
[
'--cover-erase'
,
'--with-xunit'
,
'--with-xcoverage'
,
'--cover-html'
,
'--cover-inclusive'
]
for
app
in
os
.
listdir
(
PROJECT_ROOT
/
'djangoapps'
):
NOSE_ARGS
+=
[
'--cover-package'
,
app
]
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
KEYSTORE
=
{
'host'
:
'localhost'
,
'db'
:
'mongo_base'
,
'collection'
:
'key_store'
,
}
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
ENV_ROOT
/
"db"
/
"mitx.db"
,
}
}
CACHES
=
{
# This is the cache used for most things. Askbot will not work without a
# functioning cache -- it relies on caching to load its settings in places.
# In staging/prod envs, the sessions also live here.
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.locmem.LocMemCache'
,
'LOCATION'
:
'mitx_loc_mem_cache'
,
'KEY_FUNCTION'
:
'util.memcache.safe_key'
,
},
# The general cache is what you get if you use our util.cache. It's used for
# things like caching the course.xml file for different A/B test groups.
# We set it to be a DummyCache to force reloading of course.xml in dev.
# In staging environments, we would grab VERSION from data uploaded by the
# push process.
'general'
:
{
'BACKEND'
:
'django.core.cache.backends.dummy.DummyCache'
,
'KEY_PREFIX'
:
'general'
,
'VERSION'
:
4
,
'KEY_FUNCTION'
:
'util.memcache.safe_key'
,
}
}
common/
lib
/cache_toolbox/COPYING
→
common/
djangoapps
/cache_toolbox/COPYING
View file @
5404345b
File moved
common/
lib
/cache_toolbox/README.rst
→
common/
djangoapps
/cache_toolbox/README.rst
View file @
5404345b
File moved
common/
lib
/cache_toolbox/__init__.py
→
common/
djangoapps
/cache_toolbox/__init__.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/app_settings.py
→
common/
djangoapps
/cache_toolbox/app_settings.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/core.py
→
common/
djangoapps
/cache_toolbox/core.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/middleware.py
→
common/
djangoapps
/cache_toolbox/middleware.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/model.py
→
common/
djangoapps
/cache_toolbox/model.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/relation.py
→
common/
djangoapps
/cache_toolbox/relation.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/templatetags/__init__.py
→
common/
djangoapps
/cache_toolbox/templatetags/__init__.py
View file @
5404345b
File moved
common/
lib
/cache_toolbox/templatetags/cache_toolbox.py
→
common/
djangoapps
/cache_toolbox/templatetags/cache_toolbox.py
View file @
5404345b
File moved
common/
lib
/util/__init__.py
→
common/
djangoapps
/util/__init__.py
View file @
5404345b
File moved
common/
lib
/util/cache.py
→
common/
djangoapps
/util/cache.py
View file @
5404345b
File moved
common/
lib
/util/memcache.py
→
common/
djangoapps
/util/memcache.py
View file @
5404345b
File moved
common/
lib
/util/middleware.py
→
common/
djangoapps
/util/middleware.py
View file @
5404345b
File moved
common/
lib
/util/models.py
→
common/
djangoapps
/util/models.py
View file @
5404345b
File moved
common/
lib
/util/tests.py
→
common/
djangoapps
/util/tests.py
View file @
5404345b
File moved
common/
lib
/util/views.py
→
common/
djangoapps
/util/views.py
View file @
5404345b
File moved
c
ms
/lib/keystore/__init__.py
→
c
ommon
/lib/keystore/__init__.py
View file @
5404345b
File moved
c
ms
/lib/keystore/django.py
→
c
ommon
/lib/keystore/django.py
View file @
5404345b
File moved
c
ms
/lib/keystore/exceptions.py
→
c
ommon
/lib/keystore/exceptions.py
View file @
5404345b
File moved
c
ms
/lib/keystore/mongo.py
→
c
ommon
/lib/keystore/mongo.py
View file @
5404345b
File moved
lms/envs/dev.py
View file @
5404345b
...
...
@@ -44,7 +44,7 @@ CACHES = {
'BACKEND'
:
'django.core.cache.backends.dummy.DummyCache'
,
'KEY_PREFIX'
:
'general'
,
'VERSION'
:
4
,
'KEY_FUNCTION'
:
'util.
cache.memcache_
safe_key'
,
'KEY_FUNCTION'
:
'util.
memcache.
safe_key'
,
}
}
...
...
rakefile
View file @
5404345b
...
...
@@ -66,7 +66,7 @@ end
desc
"Run all django tests on our djangoapps for the
#{
system
}
"
task
task_name
=>
report_dir
do
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
sh
(
django_admin
(
:lms
,
:test
,
'test'
,
*
Dir
[
'lms/djangoapps'
].
each
))
sh
(
django_admin
(
system
,
:test
,
'test'
,
*
Dir
[
"
#{
system
}
/djangoapps/*"
].
each
))
end
task
:test
=>
task_name
...
...
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