diff --git a/cms/djangoapps/contentstore/tests.py b/cms/djangoapps/contentstore/tests.py
deleted file mode 100644
index 501deb776c..0000000000
--- a/cms/djangoapps/contentstore/tests.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-This file demonstrates writing tests using the unittest module. These will pass
-when you run "manage.py test".
-
-Replace this with more appropriate tests for your application.
-"""
-
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
- def test_basic_addition(self):
- """
- Tests that 1 + 1 always equals 2.
- """
- self.assertEqual(1 + 1, 2)
diff --git a/cms/djangoapps/contentstore/tests/__init__.py b/cms/djangoapps/contentstore/tests/__init__.py
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/cms/djangoapps/contentstore/tests/__init__.py
@@ -0,0 +1 @@
+
diff --git a/cms/djangoapps/contentstore/tests/tests.py b/cms/djangoapps/contentstore/tests/tests.py
new file mode 100644
index 0000000000..4153c11de6
--- /dev/null
+++ b/cms/djangoapps/contentstore/tests/tests.py
@@ -0,0 +1,48 @@
+import json
+from django.test.client import Client
+from django.test import TestCase
+from mock import patch, Mock
+from override_settings import override_settings
+from django.conf import settings
+
+def parse_json(response):
+ """Parse response, which is assumed to be json"""
+ return json.loads(response.content)
+
+class AuthTestCase(TestCase):
+ """Check that various permissions-related things work"""
+
+ def test_index(self):
+ """Make sure the main page loads."""
+ resp = self.client.get('/')
+ self.assertEqual(resp.status_code, 200)
+
+ def test_signup_load(self):
+ """Make sure the signup page loads."""
+ resp = self.client.get('/signup')
+ self.assertEqual(resp.status_code, 200)
+
+
+ def test_create_account(self):
+
+ # No post data -- should fail
+ resp = self.client.post('/create_account', {})
+ self.assertEqual(resp.status_code, 200)
+ data = parse_json(resp)
+ self.assertEqual(data['success'], False)
+
+ # Should work
+ resp = self.client.post('/create_account', {
+ 'username': 'user',
+ 'email': 'a@b.com',
+ 'password': 'xyz',
+ 'location' : 'home',
+ 'language' : 'Franglish',
+ 'name' : 'Fred Weasley',
+ 'terms_of_service' : 'true',
+ 'honor_code' : 'true'})
+ self.assertEqual(resp.status_code, 200)
+ data = parse_json(resp)
+ self.assertEqual(data['success'], True)
+
+
diff --git a/cms/djangoapps/github_sync/tests/__init__.py b/cms/djangoapps/github_sync/tests/__init__.py
index b644328dd2..452904ffff 100644
--- a/cms/djangoapps/github_sync/tests/__init__.py
+++ b/cms/djangoapps/github_sync/tests/__init__.py
@@ -1,6 +1,7 @@
from django.test import TestCase
from path import path
import shutil
+import os
from github_sync import import_from_github, export_to_github
from git import Repo
from django.conf import settings
@@ -13,10 +14,18 @@ from github_sync.exceptions import GithubSyncError
@override_settings(DATA_DIR=path('test_root'))
class GithubSyncTestCase(TestCase):
+ def cleanup(self):
+ shutil.rmtree(self.repo_dir, ignore_errors=True)
+ shutil.rmtree(self.remote_dir, ignore_errors=True)
+
def setUp(self):
self.working_dir = path(settings.TEST_ROOT)
self.repo_dir = self.working_dir / 'local_repo'
self.remote_dir = self.working_dir / 'remote_repo'
+
+ # make sure there's no stale data lying around
+ self.cleanup()
+
shutil.copytree('common/test/data/toy', self.remote_dir)
remote = Repo.init(self.remote_dir)
@@ -33,8 +42,7 @@ class GithubSyncTestCase(TestCase):
})
def tearDown(self):
- shutil.rmtree(self.repo_dir)
- shutil.rmtree(self.remote_dir)
+ self.cleanup()
def test_initialize_repo(self):
"""
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 7563ea8731..721675258d 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -218,7 +218,7 @@ PIPELINE_COMPILERS = [
PIPELINE_SASS_ARGUMENTS = '-t compressed -r {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.format(proj_dir=PROJECT_ROOT)
PIPELINE_CSS_COMPRESSOR = None
-PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
+PIPELINE_JS_COMPRESSOR = None
STATICFILES_IGNORE_PATTERNS = (
"sass/*",
diff --git a/cms/envs/test.py b/cms/envs/test.py
index 927e2af987..2a867af91f 100644
--- a/cms/envs/test.py
+++ b/cms/envs/test.py
@@ -9,6 +9,8 @@ sessions. Assumes structure:
"""
from .common import *
import os
+from path import path
+
# Nose Test Runner
INSTALLED_APPS += ('django_nose',)
@@ -17,7 +19,11 @@ for app in os.listdir(PROJECT_ROOT / 'djangoapps'):
NOSE_ARGS += ['--cover-package', app]
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
-TEST_ROOT = 'test_root'
+TEST_ROOT = path('test_root')
+
+# Want static files in the same dir for running on jenkins.
+STATIC_ROOT = TEST_ROOT / "staticfiles"
+
MODULESTORE = {
'default': {
@@ -34,7 +40,7 @@ MODULESTORE = {
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': ENV_ROOT / "db" / "mitx.db",
+ 'NAME': ENV_ROOT / "db" / "cms.db",
}
}
diff --git a/cms/static/sass/_content-types.scss b/cms/static/sass/_content-types.scss
index 6df113df78..587646fb39 100644
--- a/cms/static/sass/_content-types.scss
+++ b/cms/static/sass/_content-types.scss
@@ -6,50 +6,50 @@
.videosequence a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/videosequence.png');
+ background-image: url('../img/content-types/videosequence.png');
}
.video a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/video.png');
+ background-image: url('../img/content-types/video.png');
}
.problemset a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/problemset.png');
+ background-image: url('../img/content-types/problemset.png');
}
.problem a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/problem.png');
+ background-image: url('../img/content-types/problem.png');
}
.lab a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/lab.png');
+ background-image: url('../img/content-types/lab.png');
}
.tab a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/lab.png');
+ background-image: url('../img/content-types/lab.png');
}
.html a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/html.png');
+ background-image: url('../img/content-types/html.png');
}
.vertical a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/vertical.png');
+ background-image: url('../img/content-types/vertical.png');
}
.sequential a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/sequential.png');
+ background-image: url('../img/content-types/sequential.png');
}
.chapter a:first-child {
@extend .content-type;
- background-image: url('/static/img/content-types/chapter.png');
+ background-image: url('../img/content-types/chapter.png');
}
diff --git a/cms/templates/base.html b/cms/templates/base.html
index 1092147efd..935917b11a 100644
--- a/cms/templates/base.html
+++ b/cms/templates/base.html
@@ -26,7 +26,7 @@
-
+
% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
<%static:js group='main'/>
% else:
diff --git a/lms/envs/test.py b/lms/envs/test.py
index aed49d43de..870bc5a7ec 100644
--- a/lms/envs/test.py
+++ b/lms/envs/test.py
@@ -10,6 +10,7 @@ sessions. Assumes structure:
from .common import *
from .logsettings import get_logger_config
import os
+from path import path
INSTALLED_APPS = [
app
@@ -28,6 +29,9 @@ TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
# Local Directories
TEST_ROOT = path("test_root")
+# Want static files in the same dir for running on jenkins.
+STATIC_ROOT = TEST_ROOT / "staticfiles"
+
COURSES_ROOT = TEST_ROOT / "data"
DATA_DIR = COURSES_ROOT
MAKO_TEMPLATES['course'] = [DATA_DIR]
@@ -77,7 +81,7 @@ SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
############################ FILE UPLOADS (ASKBOT) #############################
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
-MEDIA_ROOT = PROJECT_ROOT / "uploads"
+MEDIA_ROOT = TEST_ROOT / "uploads"
MEDIA_URL = "/static/uploads/"
STATICFILES_DIRS.append(("uploads", MEDIA_ROOT))
FILE_UPLOAD_TEMP_DIR = PROJECT_ROOT / "uploads"
diff --git a/rakefile b/rakefile
index 073bb421b9..c2db3a06d0 100644
--- a/rakefile
+++ b/rakefile
@@ -80,7 +80,7 @@ end
# Per System tasks
desc "Run all django tests on our djangoapps for the #{system}"
- task "test_#{system}" => [report_dir, :predjango] do
+ task "test_#{system}" => [report_dir, :predjango, "#{system}:collectstatic:test"] do
ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml")
ENV['NOSE_COVER_HTML_DIR'] = File.join(report_dir, "cover")
sh(django_admin(system, :test, 'test', *Dir["#{system}/djangoapps/*"].each))
@@ -106,7 +106,7 @@ end
desc "Run collectstatic in the specified environment"
task "#{system}:collectstatic:#{env}" => :predjango do
- sh("#{django_admin(system, env, 'collectstatic')}")
+ sh("#{django_admin(system, env, 'collectstatic', '--noinput')}")
end
end
end
diff --git a/test_root/uploads/.git-keep b/test_root/uploads/.git-keep
new file mode 100644
index 0000000000..e69de29bb2