changed cms/env/tests, added test_views.py

This commit is contained in:
Deena Wang
2013-01-29 11:06:32 -05:00
parent 74839663ff
commit 85c412fc2e
2 changed files with 10 additions and 3 deletions

View File

@@ -13,8 +13,11 @@ from django.test.client import Client
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from override_settings import override_settings
from xmodule.modulestore.django import modulestore, _MODULESTORES
import contentstore.views as views
import cms.djangoapps.contentstore.views as views
def xml_store_config(data_dir):
return {
@@ -32,7 +35,6 @@ class UserFactory(factory.Factory):
last_name = 'Robot'
is_staff = True
is_active = True
is_authenticated = True
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR)
@@ -47,4 +49,6 @@ class ViewsTestCase(TestCase):
def test_has_access(self):
user = UserFactory()
views.has_access(user, self.location)
user.is_authenticated = True
set_trace()
self.assertTrue(views.has_access(user, self.location))

View File

@@ -25,6 +25,9 @@ STATIC_ROOT = TEST_ROOT / "staticfiles"
GITHUB_REPO_ROOT = TEST_ROOT / "data"
COMMON_TEST_DATA_ROOT = COMMON_ROOT / "test" / "data"
# Makes the tests run much faster...
SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
# TODO (cpennington): We need to figure out how envs/test.py can inject things into common.py so that we don't have to repeat this sort of thing
STATICFILES_DIRS = [
COMMON_ROOT / "static",