コード例 #1
0
    def test_starting_page(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '-q', '-u', '--django-version=1.8',
                                    '--cms-version=3.2', '--starting-page=yes',
                                    '-p' + self.project_dir, 'cms_project'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        django.load_starting_page(config_data)
        project_db = sqlite3.connect(os.path.join(config_data.project_directory, 'test.db'))

        # Check loaded data
        query = project_db.execute('SELECT * FROM cms_page')
        row = query.fetchone()
        self.assertTrue('fullwidth.html' in row)

        query = project_db.execute('SELECT * FROM cms_title')
        row = query.fetchone()
        self.assertTrue('Home' in row)

        query = project_db.execute('SELECT * FROM cms_cmsplugin')
        row = query.fetchone()
        self.assertTrue('TextPlugin' in row)
コード例 #2
0
ファイル: django.py プロジェクト: addsimm/cms8
    def test_database_setup(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '-q', '--cms-version=3.1', '--django=%s' % dj_ver,
                                    '-p'+self.project_dir, 'cms_project'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        project_db = sqlite3.connect(os.path.join(config_data.project_directory, 'test.db'))

        # Checking content type table to check for correct applications setup
        query = project_db.execute('SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"')
        row = query.fetchone()
        self.assertTrue('page' in row)
        self.assertTrue('cms' in row)

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute('SELECT * FROM cms_page')
        self.assertTrue(query)

        # No data in auth tables at setup time due to the no-input
        query = project_db.execute('SELECT * FROM auth_user')
        self.assertTrue(query)
コード例 #3
0
ファイル: django.py プロジェクト: nephila/djangocms-installer
    def test_patch_110_settings(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.10',
                                    '--cms-version=3.4', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_110_settings'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertEqual(project.settings.MEDIA_ROOT,
                         os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        # Data from external settings files
        self.assertIsNotNone(getattr(project.settings, 'MIDDLEWARE', None))
        self.assertIsNone(getattr(project.settings, 'MIDDLEWARE_CLASSES', None))
コード例 #4
0
    def disabled_test_setup_database_filer(self):
        config_data = config.parse(
            [
                "--db=sqlite://localhost/test.db",
                "-f",
                "-q",
                "-u",
                "--cms-version=develop",
                "-p" + self.project_dir,
                "cms_project",
            ]
        )
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        project_db = sqlite3.connect(os.path.join(config_data.project_directory, "test.db"))

        # Checking content type table to check for correct applications setup
        query = project_db.execute('SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"')
        self.assertEqual(query.fetchone()[1], "page")
        query = project_db.execute('SELECT * FROM django_content_type WHERE app_label="filer" AND model="image"')
        self.assertEqual(query.fetchone()[1], "image")

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute("SELECT * FROM cms_page")
        self.assertTrue(query)
コード例 #5
0
    def test_patch_19_32_settings(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.9',
                                    '--cms-version=3.2', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_16_settigns'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertEqual(project.settings.MEDIA_ROOT,
                         os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        # Data from external settings file
        self.assertEqual(project.settings.CUSTOM_SETTINGS_VAR, True)
        self.assertEqual(project.settings.CMS_PERMISSION, False)
        self.assertEqual(set(project.settings.CMS_TEMPLATES), self.templates_basic)
コード例 #6
0
    def test_patch_django_19_develop(self):
        # On django CMS 3.2 the reload apphooks middleware is enabled by default
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.9', '-f',
                                    '--cms-version=develop', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_19_32_settings'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, 'TEMPLATES_DIR', False))
        self.assertTrue(
            config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS_OLD not in
            project.settings.MIDDLEWARE_CLASSES
        )
        self.assertTrue(
            config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS in
            project.settings.MIDDLEWARE_CLASSES
        )
コード例 #7
0
 def test_create_project(self):
     config_data = config.parse(['--db=postgres://user:pwd@host/dbname',
                                 '--cms-version=stable', '--django=%s' % dj_ver,
                                 '-q', '-p' + self.project_dir, 'example_prj'])
     install.requirements(config_data.requirements)
     django.create_project(config_data)
     self.assertTrue(os.path.exists(os.path.join(self.project_dir, 'example_prj')))
コード例 #8
0
ファイル: django.py プロジェクト: addsimm/cms8
    def test_patch_django_16(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--bootstrap=yes',
                                    '--django-version=1.6', '--apphooks-reload',
                                    '--cms-version=3.0', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_path_16'])

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertEqual(project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        self.assertEqual(project.settings.TIME_ZONE, 'Europe/Moscow')
        self.assertTrue('cmsplugin_filer_image' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_folder' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_utils' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_text_ckeditor' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_admin_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('filer' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_column' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_file' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_flash' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' in project.settings.INSTALLED_APPS)
        self.assertTrue('aldryn_apphook_reload' in project.settings.INSTALLED_APPS)
        self.assertTrue(config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS_OLD in project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue(config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS not in project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue('cms.context_processors.cms_settings' in project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('cms.context_processors.media' not in project.settings.TEMPLATE_CONTEXT_PROCESSORS)

        self.assertEqual(set(project.settings.CMS_TEMPLATES), self.templates_bootstrap)

        self.assertEqual(len(re.findall('BASE_DIR = ', settings)), 1)
        self.assertEqual(len(re.findall('STATIC_ROOT', settings)), 1)
        self.assertEqual(len(re.findall('MEDIA_ROOT =', settings)), 1)
        self.assertEqual(len(re.findall('STATICFILES_DIRS', settings)), 1)
コード例 #9
0
ファイル: django.py プロジェクト: jjdd12/supermascota
    def test_patch_16(self):
        config_data = config.parse(
            [
                "--db=sqlite://localhost/test.db",
                "--lang=en",
                "--django-version=1.6",
                "--cms-version=3.0",
                "-q",
                "-u",
                "-zno",
                "--i18n=no",
                "-p" + self.project_dir,
                "example_path_16",
            ]
        )

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), ["settings"])

        ## checking for django options
        self.assertTrue(project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, "media"))
        self.assertEqual(project.settings.MEDIA_URL, "/media/")

        self.assertTrue("cmsplugin_filer_image" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_file" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_folder" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_link" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_utils" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cmsplugin_filer_video" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_text_ckeditor" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_admin_style" in project.settings.INSTALLED_APPS)
        self.assertTrue("filer" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_column" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_file" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_flash" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_googlemap" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_inherit" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_link" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_picture" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_style" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_teaser" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_video" in project.settings.INSTALLED_APPS)

        self.assertEqual(len(re.findall("BASE_DIR = ", settings)), 1)
        self.assertEqual(len(re.findall("STATIC_ROOT", settings)), 1)
        self.assertEqual(len(re.findall("MEDIA_ROOT =", settings)), 1)
        self.assertEqual(len(re.findall("STATICFILES_DIRS", settings)), 2)
コード例 #10
0
 def test_create_project(self):
     dj_version, dj_match = get_latest_django(latest_stable=True)
     config_data = config.parse([
         '--db=postgres://user:pwd@host/dbname', '--cms-version=stable',
         '--django=%s' % dj_version, '-q', '-p' + self.project_dir,
         'example_prj'
     ])
     install.requirements(config_data.requirements)
     django.create_project(config_data)
     self.assertTrue(
         os.path.exists(os.path.join(self.project_dir, 'example_prj')))
コード例 #11
0
ファイル: django.py プロジェクト: sammaurya/djanocms-empcms
    def test_patch_django_111_no_plugins(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data',
                                  'extra_settings.py')
        config_data = config.parse([
            '--db=sqlite://localhost/test.db', '--lang=en',
            '--extra-settings=%s' % extra_path, '--django-version=1.11', '-f',
            '--no-plugins',
            '--cms-version=%s' % cms_stable, '--timezone=Europe/Moscow', '-q',
            '-u', '-zno', '--i18n=no', '-p' + self.project_dir,
            'test_patch_django_111_no_plugins'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, 'TEMPLATES_DIR', False))
        self.assertFalse('djangocms_file' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_flash' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'djangocms_picture' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_teaser' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_video' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.file' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.flash' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.googlemap' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.inherit' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.link' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.picture' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.teaser' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.text' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.twitter' in project.settings.INSTALLED_APPS)
        self.assertFalse(
            'cms.plugins.video' in project.settings.INSTALLED_APPS)
コード例 #12
0
 def test_create_project(self):
     config_data = config.parse(
         [
             "--db=postgres://user:pwd@host/dbname",
             "--cms-version=develop",
             "-q",
             "-p" + self.project_dir,
             "example_prj",
         ]
     )
     install.requirements(config_data.requirements)
     django.create_project(config_data)
     self.assertTrue(os.path.exists(os.path.join(self.project_dir, "example_prj")))
コード例 #13
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_database_setup_filer(self):
        dj_version, dj_match = get_stable_django()
        cms_stable, cms_match = get_stable_djangocms()

        config_data = config.parse([
            "--db=sqlite://localhost/test.db",
            "--cms-version=%s" % cms_stable,
            "-f",
            "-q",
            "-u",
            "--django-version=%s" % dj_version,
            "-p" + self.project_dir,
            "cms_project",
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        project_db = sqlite3.connect(
            os.path.join(config_data.project_directory, "test.db"))

        # Checking content type table to check for correct applications setup
        query = project_db.execute(
            'SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"'
        )
        row = query.fetchone()
        self.assertTrue("page" in row)
        self.assertTrue("cms" in row)

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute("SELECT * FROM cms_page")
        self.assertTrue(query)

        # No data in auth tables at setup time due to the no-input
        query = project_db.execute("SELECT * FROM auth_user")
        self.assertTrue(query)

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute("SELECT * FROM cms_page")
        self.assertTrue(query)

        # Check filer data
        query = project_db.execute(
            'SELECT * FROM django_content_type WHERE app_label="filer" AND model="image"'
        )
        row = query.fetchone()
        self.assertTrue("filer" in row)
        self.assertTrue("image" in row)
コード例 #14
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
 def test_create_project(self):
     dj_version, dj_match = get_stable_django()
     config_data = config.parse([
         "--db=postgres://user:pwd@host/dbname",
         "--cms-version=develop",
         "--django=%s" % dj_version,
         "-q",
         "-p" + self.project_dir,
         "example_prj",
     ])
     install.requirements(config_data.requirements)
     django.create_project(config_data)
     self.assertTrue(
         os.path.exists(os.path.join(self.project_dir, "example_prj")))
コード例 #15
0
    def test_patch(self):
        config_data = config.parse(
            [
                "--db=sqlite://localhost/test.db",
                "--lang=en",
                "--cms-version=develop",
                "-f",
                "-q",
                "-u",
                "-zno",
                "--i18n=no",
                "-p" + self.project_dir,
                "example_patch",
            ]
        )
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), ["settings"])

        ## checking for django options
        self.assertFalse(project.settings.USE_L10N)
        self.assertFalse(project.settings.USE_TZ)
        self.assertEqual(project.settings.LANGUAGE_CODE, "en")
        #
        ## checking for standard CMS settings
        self.assertTrue("sekizai.context_processors.sekizai" in project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue("cms.middleware.toolbar.ToolbarMiddleware" in project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue(project.settings.CMS_LANGUAGES["default"]["redirect_on_fallback"])
        self.assertEqual(project.settings.CMS_LANGUAGES[1][0]["code"], "en")

        ## checking for filer (optional) settings
        self.assertTrue("filer" in project.settings.INSTALLED_APPS)
        self.assertTrue("easy_thumbnails" in project.settings.INSTALLED_APPS)
        self.assertTrue(hasattr(project.settings, "THUMBNAIL_PROCESSORS"))

        ## basic urlconf check
        self.assertTrue("cms.urls" in urlconf)
        self.assertTrue("staticfiles_urlpatterns" in urlconf)

        sys.path.remove(config_data.project_directory)
        del project
        del (sys.modules["%s.settings" % config_data.project_name])
コード例 #16
0
ファイル: django.py プロジェクト: sammaurya/djanocms-empcms
 def test_django_admin_errors(self):
     dj_version, dj_match = get_latest_django(latest_stable=True)
     config_data = config.parse([
         '--db=postgres://user:pwd@host/dbname',
         '--cms-version=%s' % cms_stable,
         '--django=%s' % dj_version, '-q', '-p' + self.project_dir,
         'example_prj'
     ])
     install.requirements(config_data.requirements)
     config_data.project_name = 'example.prj'
     with self.assertRaises(RuntimeError) as e:
         django.create_project(config_data)
     self.assertTrue(
         '\'example.prj\' is not a valid project name.' in str(e.exception))
コード例 #17
0
ファイル: django.py プロジェクト: jjdd12/supermascota
    def test_patch_24_standard(self):
        config_data = config.parse(
            [
                "--db=sqlite://localhost/test.db",
                "--lang=en",
                "--django-version=1.5",
                "--cms-version=2.4",
                "-q",
                "-u",
                "-zno",
                "--i18n=no",
                "-p" + self.project_dir,
                "example_path_24_s",
            ]
        )

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), ["settings"])

        ## checking for django options
        self.assertTrue(project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, "media"))
        self.assertEqual(project.settings.MEDIA_URL, "/media/")
        self.assertTrue("djangocms_file" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_flash" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_googlemap" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_inherit" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_link" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_picture" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_video" not in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.file" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.flash" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.googlemap" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.inherit" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.link" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.picture" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.teaser" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.text" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.twitter" in project.settings.INSTALLED_APPS)
        self.assertTrue("cms.plugins.video" in project.settings.INSTALLED_APPS)
コード例 #18
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
 def test_django_admin_errors(self):
     dj_version, dj_match = get_stable_django()
     config_data = config.parse([
         "--db=postgres://user:pwd@host/dbname",
         "--cms-version=develop",
         "--django=%s" % dj_version,
         "-q",
         "-p" + self.project_dir,
         "example_prj",
     ])
     install.requirements(config_data.requirements)
     config_data.project_name = "example.prj"
     with self.assertRaises(RuntimeError) as e:
         django.create_project(config_data)
     self.assertTrue(
         "'example.prj' is not a valid project name." in str(e.exception))
コード例 #19
0
ファイル: django.py プロジェクト: nephila/djangocms-installer
 def test_force_django(self):
     config_data = config.parse(['--db=sqlite://localhost/test.db',
                                 '-q', '-u', '--django-version=1.11',
                                 '--cms-version=3.4', '--starting-page=yes',
                                 '-p' + self.project_dir, 'cms_project'])
     install.requirements(config_data.requirements)
     install.requirements('django<1.9')
     django.create_project(config_data)
     with patch('sys.stdout', self.stdout):
         with patch('sys.stderr', self.stderr):
             with self.assertRaises(SystemExit) as error:
                 django.patch_settings(config_data)
     self.assertEqual(error.exception.code, 9)
     self.assertTrue(self.stderr.getvalue().find(
         'Currently installed Django version 1.8.19 differs from the declared 1.11'
     ) > -1)
コード例 #20
0
ファイル: django.py プロジェクト: AaronJaramillo/shopDPM
    def test_patch_cms_24_standard(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en',
                                    '--django-version=1.5',
                                    '--cms-version=2.4',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_24_s'])

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.MEDIA_ROOT,
                        os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')
        self.assertTrue(
            'cms.context_processors.cms_settings' not in project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue(
            'cms.context_processors.media' in project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('djangocms_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_flash' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_googlemap' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.file' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.flash' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.link' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.picture' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.text' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.twitter' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.video' in project.settings.INSTALLED_APPS)
コード例 #21
0
ファイル: django.py プロジェクト: sammaurya/djanocms-empcms
    def test_database_setup_filer(self):
        dj_version, dj_match = get_latest_django(latest_stable=True)

        config_data = config.parse([
            '--db=sqlite://localhost/test.db',
            '--cms-version=%s' % cms_stable, '-f', '-q', '-u',
            '--django-version=%s' % dj_version, '-p' + self.project_dir,
            'cms_project'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        project_db = sqlite3.connect(
            os.path.join(config_data.project_directory, 'test.db'))

        # Checking content type table to check for correct applications setup
        query = project_db.execute(
            'SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"'
        )
        row = query.fetchone()
        self.assertTrue('page' in row)
        self.assertTrue('cms' in row)

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute('SELECT * FROM cms_page')
        self.assertTrue(query)

        # No data in auth tables at setup time due to the no-input
        query = project_db.execute('SELECT * FROM auth_user')
        self.assertTrue(query)

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute('SELECT * FROM cms_page')
        self.assertTrue(query)

        # Check filer data
        query = project_db.execute(
            'SELECT * FROM django_content_type WHERE app_label="filer" AND model="image"'
        )
        row = query.fetchone()
        self.assertTrue('filer' in row)
        self.assertTrue('image' in row)
コード例 #22
0
 def test_force_django(self):
     config_data = config.parse([
         '--db=sqlite://localhost/test.db', '-q', '-u',
         '--django-version=1.11', '--cms-version=3.4',
         '--starting-page=yes', '-p' + self.project_dir, 'cms_project'
     ])
     install.requirements(config_data.requirements)
     install.requirements('django<1.9')
     django.create_project(config_data)
     with patch('sys.stdout', self.stdout):
         with patch('sys.stderr', self.stderr):
             with self.assertRaises(SystemExit) as error:
                 django.patch_settings(config_data)
     self.assertEqual(error.exception.code, 9)
     self.assertTrue(self.stderr.getvalue().find(
         'Currently installed Django version 1.8.19 differs from the declared 1.11'
     ) > -1)
コード例 #23
0
ファイル: django.py プロジェクト: SurfasJones/djcmsrc3
    def test_patch_16(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en',
                                    '--django-version=1.6',
                                    '--cms-version=develop',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_path_16'])

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name,
                             globals(), locals(), ['settings'])

        ## checking for django options
        self.assertTrue(project.settings.MEDIA_ROOT, os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        self.assertTrue('cmsplugin_filer_image' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_folder' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_utils' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_text_ckeditor' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_admin_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('filer' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_column' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_file' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_flash' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' in project.settings.INSTALLED_APPS)
コード例 #24
0
    def test_setup_database(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '-q', '-u', '--cms-version=develop',
                                    '-p'+self.project_dir, 'cms_project'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        django.setup_database(config_data)
        project_db = sqlite3.connect(os.path.join(config_data.project_directory, 'test.db'))

        # Checking content type table to check for correct applications setup
        query = project_db.execute('SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"')
        self.assertEqual(query.fetchone()[1], 'page')

        # No data in CMS tables at setup time, but if query succeed database
        # schema should be fine
        query = project_db.execute('SELECT * FROM cms_page')
        self.assertTrue(query)
コード例 #25
0
    def test_patch(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en',
                                    '--cms-version=develop',
                                    '-f', '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_patch'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name,
                             globals(), locals(), ['settings'])

        ## checking for django options
        self.assertFalse(project.settings.USE_L10N)
        self.assertFalse(project.settings.USE_TZ)
        self.assertEqual(project.settings.LANGUAGE_CODE, 'en')
        #
        ## checking for standard CMS settings
        self.assertTrue('sekizai.context_processors.sekizai' in project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('cms.middleware.toolbar.ToolbarMiddleware' in project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue(project.settings.CMS_LANGUAGES['default']['redirect_on_fallback'])
        self.assertEqual(project.settings.CMS_LANGUAGES[1][0]['code'], 'en')

        ## checking for filer (optional) settings
        self.assertTrue('filer' in project.settings.INSTALLED_APPS)
        self.assertTrue('easy_thumbnails' in project.settings.INSTALLED_APPS)
        self.assertTrue(hasattr(project.settings, 'THUMBNAIL_PROCESSORS'))

        ## basic urlconf check
        self.assertTrue('cms.urls' in urlconf)
        self.assertTrue('staticfiles_urlpatterns' in urlconf)

        sys.path.remove(config_data.project_directory)
        del project
        del(sys.modules["%s.settings" % config_data.project_name])
コード例 #26
0
ファイル: django.py プロジェクト: frankip/cmsaldryn_blog
    def disable_test_patch_16_aldryn(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data',
                                  'extra_settings.py')
        config_data = config.parse([
            '--db=sqlite://localhost/test.db',
            '--lang=en',
            '--extra-settings=%s' % extra_path,
            '--django-version=1.6',  # '-a',
            '--cms-version=3.0',
            '--timezone=Europe/Moscow',
            '-q',
            '-u',
            '-zno',
            '--i18n=no',
            '-p' + self.project_dir,
            'example_path_16_aldryn'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking for django options
        self.assertEqual(
            project.settings.MEDIA_ROOT,
            os.path.join(config_data.project_directory, 'dist', 'media'))
        self.assertEqual(
            project.settings.TEMPLATE_DIRS,
            (os.path.join(config_data.project_directory, 'templates'), ))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        # Data from external settings file
        self.assertEqual(project.settings.CUSTOM_SETTINGS_VAR, True)
        self.assertEqual(project.settings.CMS_PERMISSION, False)
        self.assertEqual(set(project.settings.CMS_TEMPLATES),
                         self.templates_basic)
        self.assertTrue('compressor' in project.settings.INSTALLED_APPS)
コード例 #27
0
ファイル: django.py プロジェクト: AaronJaramillo/shopDPM
    def test_patch_cms_24_filer(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en',
                                    '--django-version=1.5',
                                    '--cms-version=2.4',
                                    '-f', '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_24_f'])
        reqs = config_data.requirements.replace('django-mptt>=0.5.1,<0.5.3', '')
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.MEDIA_ROOT,
                        os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')
        self.assertTrue('djangocms_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_flash' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_googlemap' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_image' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.flash' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('cms.plugins.inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_file' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_folder' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_utils' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_video' in project.settings.INSTALLED_APPS)
コード例 #28
0
ファイル: django.py プロジェクト: addsimm/cms8
    def test_patch_django_18_31(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.8', '-f',
                                    '--cms-version=stable', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_path_18_31_settings'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, 'TEMPLATES_DIR', False))
コード例 #29
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_patch_22_settings(self):
        dj_version, dj_match = get_stable_django()
        cms_stable, cms_match = get_stable_djangocms()

        extra_path = os.path.join(os.path.dirname(__file__), "data",
                                  "extra_settings.py")
        config_data = config.parse([
            "--db=sqlite://localhost/test.db",
            "--lang=en",
            "--extra-settings=%s" % extra_path,
            "--cms-version=%s" % cms_stable,
            "--django-version=%s" % dj_version,
            "--timezone=Europe/Moscow",
            "-q",
            "-u",
            "-zno",
            "--i18n=no",
            "-p" + self.project_dir,
            "example_path_111_settings",
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             ["settings"])

        # checking for django options
        self.assertEqual(
            project.settings.MEDIA_ROOT,
            os.path.join(config_data.project_directory, "media"),
        )
        self.assertEqual(project.settings.MEDIA_URL, "/media/")

        # Data from external settings files
        self.assertIsNotNone(getattr(project.settings, "MIDDLEWARE", None))
        self.assertIsNone(getattr(project.settings, "MIDDLEWARE_CLASSES",
                                  None))
コード例 #30
0
    def test_patch_django_18_32(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.8', '--cms-version=3.2',
                                    '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_17_settings'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertFalse('south' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms' in project.settings.MIGRATION_MODULES)
        self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES)
コード例 #31
0
ファイル: django.py プロジェクト: addsimm/cms8
    def test_patch_31(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--cms=develop',
                                    '--django-version=1.6',
                                    '--timezone=Europe/Moscow',
                                    '-f', '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_path_patch_31'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking mptt / treebeard
        self.assertFalse('mptt' in project.settings.INSTALLED_APPS)
        self.assertTrue('treebeard' in project.settings.INSTALLED_APPS)
コード例 #32
0
    def test_patch_django_no_plugins(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.8', '-f', '--no-plugins',
                                    '--cms-version=stable', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_no_plugin'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, 'TEMPLATES_DIR', False))
        self.assertFalse('djangocms_file' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_flash' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_picture' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_teaser' in project.settings.INSTALLED_APPS)
        self.assertFalse('djangocms_video' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.file' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.flash' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.googlemap' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.inherit' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.link' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.picture' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.teaser' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.text' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.twitter' in project.settings.INSTALLED_APPS)
        self.assertFalse('cms.plugins.video' in project.settings.INSTALLED_APPS)
コード例 #33
0
ファイル: django.py プロジェクト: frankip/cmsaldryn_blog
    def test_patch_django_18_31(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data',
                                  'extra_settings.py')
        config_data = config.parse([
            '--db=sqlite://localhost/test.db', '--lang=en',
            '--extra-settings=%s' % extra_path, '--django-version=1.8', '-f',
            '--cms-version=stable', '--timezone=Europe/Moscow', '-q', '-u',
            '-zno', '--i18n=no', '-p' + self.project_dir,
            'example_path_18_31_settings'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, 'TEMPLATES_DIR', False))
コード例 #34
0
ファイル: django.py プロジェクト: frankip/cmsaldryn_blog
    def test_patch_31(self):
        config_data = config.parse([
            '--db=sqlite://localhost/test.db', '--lang=en', '--cms=3.1',
            '--django-version=1.6', '--timezone=Europe/Moscow', '-f', '-q',
            '-u', '-zno', '--i18n=no', '-p' + self.project_dir,
            'example_path_patch_31'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking mptt / treebeard
        self.assertFalse('mptt' in project.settings.INSTALLED_APPS)
        self.assertTrue('treebeard' in project.settings.INSTALLED_APPS)
コード例 #35
0
ファイル: django.py プロジェクト: clk824/djangocms-installer
    def test_patch_django_17_31(self):
        extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en', '--extra-settings=%s' % extra_path,
                                    '--django-version=1.7', '-f',
                                    '--cms-version=develop', '--timezone=Europe/Moscow',
                                    '-q', '-u', '-zno', '--i18n=no',
                                    '-p'+self.project_dir, 'example_path_17_31_settings'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name,
                             globals(), locals(), ['settings'])

        ## checking for django options
        self.assertFalse('south' in project.settings.INSTALLED_APPS)
        for module in MIGRATION_MODULES_3_1_FILER:
            self.assertTrue(module[0] in project.settings.MIGRATION_MODULES.keys())
            self.assertTrue(module[1] in project.settings.MIGRATION_MODULES.values())
コード例 #36
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_patch_django_22_develop(self):
        dj_version, dj_match = get_stable_django(lts=True)
        extra_path = os.path.join(os.path.dirname(__file__), "data",
                                  "extra_settings.py")

        params = [
            "--db=sqlite://localhost/test.db",
            "--lang=en",
            "--extra-settings=%s" % extra_path,
            "--django-version=%s" % dj_version,
            "-f",
            "--cms-version=develop",
            "--timezone=Europe/Moscow",
            "-q",
            "-u",
            "-zno",
            "--i18n=no",
            "-p" + self.project_dir,
            "test_patch_django_21_develop",
        ]
        config_data = config.parse(params)
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             ["settings"])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, "TEMPLATES_DIR", False))
        self.assertTrue(config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS
                        in project.settings.MIDDLEWARE)
コード例 #37
0
ファイル: django.py プロジェクト: frankip/cmsaldryn_blog
    def test_patch(self):
        config_data = config.parse([
            '--db=sqlite://localhost/test.db', '--lang=en',
            '--django-version=1.5', '--cms-version=3.0',
            '--timezone=Europe/Moscow', '-f', '-q', '-u', '-zno', '--i18n=no',
            '-p' + self.project_dir, 'example_path_patch'
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking for django options
        self.assertFalse(project.settings.USE_L10N)
        self.assertFalse(project.settings.USE_TZ)
        self.assertEqual(project.settings.TIME_ZONE, 'Europe/Moscow')
        self.assertEqual(project.settings.LANGUAGE_CODE, 'en')
        self.assertTrue(project.settings.MEDIA_ROOT,
                        os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')
        #
        # checking for standard CMS settings
        self.assertTrue('sekizai.context_processors.sekizai' in
                        project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('cms.middleware.toolbar.ToolbarMiddleware' in
                        project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue(
            project.settings.CMS_LANGUAGES['default']['redirect_on_fallback'])
        self.assertEqual(project.settings.CMS_LANGUAGES[1][0]['code'], 'en')

        # checking mptt / treebeard
        self.assertTrue('mptt' in project.settings.INSTALLED_APPS)
        self.assertFalse('treebeard' in project.settings.INSTALLED_APPS)

        # checking for filer (optional) settings
        self.assertTrue('filer' in project.settings.INSTALLED_APPS)
        self.assertTrue('easy_thumbnails' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_image' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_file' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_folder' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_utils' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_video' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_text_ckeditor' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_admin_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('filer' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_column' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_flash' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_picture' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_style' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue(hasattr(project.settings, 'THUMBNAIL_PROCESSORS'))
        self.assertTrue('cms.context_processors.cms_settings' in
                        project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('cms.context_processors.media' not in
                        project.settings.TEMPLATE_CONTEXT_PROCESSORS)

        # basic urlconf check
        self.assertTrue('cms.urls' in urlconf)
        self.assertTrue('staticfiles_urlpatterns' in urlconf)

        sys.path.remove(config_data.project_directory)
        del project
        del (sys.modules["%s.settings" % config_data.project_name])
コード例 #38
0
ファイル: django.py プロジェクト: frankip/cmsaldryn_blog
    def test_patch_django_16(self):
        config_data = config.parse([
            '--db=sqlite://localhost/test.db', '--lang=en', '--bootstrap=yes',
            '--django-version=1.6', '--apphooks-reload', '--cms-version=3.0',
            '--timezone=Europe/Moscow', '-q', '-u', '-zno', '--i18n=no',
            '-p' + self.project_dir, 'example_path_16'
        ])

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             [str('settings')])

        # checking for django options
        self.assertEqual(project.settings.MEDIA_ROOT,
                         os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')

        self.assertEqual(project.settings.TIME_ZONE, 'Europe/Moscow')
        self.assertTrue(
            'cmsplugin_filer_image' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_folder' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_utils' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'cmsplugin_filer_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_text_ckeditor' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_admin_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('filer' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_column' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_file' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_flash' not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            'aldryn_apphook_reload' in project.settings.INSTALLED_APPS)
        self.assertTrue(
            config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS_OLD in
            project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue(config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS
                        not in project.settings.MIDDLEWARE_CLASSES)
        self.assertTrue('cms.context_processors.cms_settings' in
                        project.settings.TEMPLATE_CONTEXT_PROCESSORS)
        self.assertTrue('cms.context_processors.media' not in
                        project.settings.TEMPLATE_CONTEXT_PROCESSORS)

        self.assertEqual(set(project.settings.CMS_TEMPLATES),
                         self.templates_bootstrap)

        self.assertEqual(len(re.findall('BASE_DIR = ', settings)), 1)
        self.assertEqual(len(re.findall('STATIC_ROOT', settings)), 1)
        self.assertEqual(len(re.findall('MEDIA_ROOT =', settings)), 1)
        self.assertEqual(len(re.findall('STATICFILES_DIRS', settings)), 1)
コード例 #39
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_patch_django_22_37(self):
        dj_version, dj_match = get_stable_django()

        config_data = config.parse([
            "--db=sqlite://localhost/test.db",
            "--lang=en",
            "--bootstrap=yes",
            "--django-version=%s" % dj_version,
            "--cms-version=3.7",
            "--timezone=Europe/Moscow",
            "-q",
            "-u",
            "-zno",
            "--i18n=no",
            "-p" + self.project_dir,
            "test_patch_django_111_36",
        ])

        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             ["settings"])

        # checking for django options
        self.assertEqual(
            project.settings.MEDIA_ROOT,
            os.path.join(config_data.project_directory, "media"),
        )
        self.assertEqual(project.settings.MEDIA_URL, "/media/")

        self.assertEqual(project.settings.TIME_ZONE, "Europe/Moscow")
        self.assertTrue(
            "cmsplugin_filer_image" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_file" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_folder" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_link" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_utils" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_video" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_text_ckeditor" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_admin_style" in project.settings.INSTALLED_APPS)
        self.assertTrue("filer" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_bootstrap4" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_file" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_flash" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_googlemap" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_inherit" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_link" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_picture" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_style" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_video" in project.settings.INSTALLED_APPS)
        self.assertTrue(config.get_settings().APPHOOK_RELOAD_MIDDLEWARE_CLASS
                        in project.settings.MIDDLEWARE)
        self.assertEqual(set(project.settings.CMS_TEMPLATES),
                         self.templates_bootstrap)

        self.assertTrue(project.settings.TEMPLATES)
        self.assertEqual(len(re.findall("BASE_DIR = ", settings)), 1)
        self.assertEqual(len(re.findall("STATIC_ROOT", settings)), 1)
        self.assertEqual(len(re.findall("MEDIA_ROOT =", settings)), 1)
        self.assertEqual(len(re.findall("STATICFILES_DIRS", settings)), 1)
コード例 #40
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_patch_django_base_no_plugins(self):
        dj_version, dj_match = get_stable_django()
        cms_stable, cms_match = get_stable_djangocms()

        extra_path = os.path.join(os.path.dirname(__file__), "data",
                                  "extra_settings.py")
        config_data = config.parse([
            "--db=sqlite://localhost/test.db",
            "--lang=en",
            "--extra-settings=%s" % extra_path,
            "--django-version=%s" % dj_version,
            "-f",
            "--no-plugins",
            "--cms-version=%s" % cms_stable,
            "--timezone=Europe/Moscow",
            "-q",
            "-u",
            "-zno",
            "--i18n=no",
            "-p" + self.project_dir,
            "test_patch_django_111_no_plugins",
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             ["settings"])

        # checking for django options
        self.assertTrue(project.settings.TEMPLATES)
        self.assertFalse(getattr(project.settings, "TEMPLATES_DIR", False))
        self.assertFalse("djangocms_file" in project.settings.INSTALLED_APPS)
        self.assertFalse("djangocms_flash" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "djangocms_googlemap" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "djangocms_inherit" in project.settings.INSTALLED_APPS)
        self.assertFalse("djangocms_link" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "djangocms_picture" in project.settings.INSTALLED_APPS)
        self.assertFalse("djangocms_teaser" in project.settings.INSTALLED_APPS)
        self.assertFalse("djangocms_video" in project.settings.INSTALLED_APPS)
        self.assertFalse("cms.plugins.file" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.flash" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.googlemap" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.inherit" in project.settings.INSTALLED_APPS)
        self.assertFalse("cms.plugins.link" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.picture" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.teaser" in project.settings.INSTALLED_APPS)
        self.assertFalse("cms.plugins.text" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.twitter" in project.settings.INSTALLED_APPS)
        self.assertFalse(
            "cms.plugins.video" in project.settings.INSTALLED_APPS)
コード例 #41
0
ファイル: django.py プロジェクト: Rupeshroc/djangocms
    def test_patch(self):
        dj_version, dj_match = get_stable_django()
        cms_stable, cms_match = get_stable_djangocms()

        config_data = config.parse([
            "--db=sqlite://localhost/test.db",
            "--lang=en",
            "--cms-version=%s" % cms_stable,
            "--django-version=%s" % dj_version,
            "--timezone=Europe/Moscow",
            "-f",
            "-q",
            "-u",
            "-zno",
            "--i18n=no",
            "-p" + self.project_dir,
            "example_path_patch",
        ])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(),
                             ["settings"])

        # checking for django options
        self.assertFalse(project.settings.USE_L10N)
        self.assertFalse(project.settings.USE_TZ)
        self.assertEqual(project.settings.TIME_ZONE, "Europe/Moscow")
        self.assertEqual(project.settings.LANGUAGE_CODE, "en")
        self.assertTrue(
            project.settings.MEDIA_ROOT,
            os.path.join(config_data.project_directory, "media"),
        )
        self.assertEqual(project.settings.MEDIA_URL, "/media/")
        #
        # checking for standard CMS settings
        self.assertTrue("sekizai.context_processors.sekizai" in project.
                        settings.TEMPLATES[0]["OPTIONS"]["context_processors"])
        self.assertTrue("cms.middleware.toolbar.ToolbarMiddleware" in
                        project.settings.MIDDLEWARE)
        self.assertTrue(
            project.settings.CMS_LANGUAGES["default"]["redirect_on_fallback"])
        self.assertEqual(project.settings.CMS_LANGUAGES[1][0]["code"], "en")

        # checking mptt / treebeard
        self.assertFalse("mptt" in project.settings.INSTALLED_APPS)
        self.assertTrue("treebeard" in project.settings.INSTALLED_APPS)

        # checking for filer (optional) settings
        self.assertTrue("filer" in project.settings.INSTALLED_APPS)
        self.assertTrue("easy_thumbnails" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_image" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_file" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_folder" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_link" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_utils" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "cmsplugin_filer_video" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_text_ckeditor" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_admin_style" in project.settings.INSTALLED_APPS)
        self.assertTrue("filer" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_file" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_flash" not in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_googlemap" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_inherit" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_link" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_picture" in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_style" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_teaser" not in project.settings.INSTALLED_APPS)
        self.assertTrue("djangocms_video" in project.settings.INSTALLED_APPS)
        self.assertTrue(
            "djangocms_bootstrap4" in project.settings.INSTALLED_APPS)
        self.assertTrue(hasattr(project.settings, "THUMBNAIL_PROCESSORS"))
        self.assertTrue("cms.context_processors.cms_settings" in project.
                        settings.TEMPLATES[0]["OPTIONS"]["context_processors"])
        self.assertTrue("cms.context_processors.media" not in project.settings.
                        TEMPLATES[0]["OPTIONS"]["context_processors"])

        # basic urlconf check
        self.assertTrue("cms.urls" in urlconf)
        self.assertTrue("static(settings.MEDIA_URL" in urlconf)
        self.assertTrue("static(settings.STATIC_URL" in urlconf)

        sys.path.remove(config_data.project_directory)
        del project
        del sys.modules["%s.settings" % config_data.project_name]
コード例 #42
0
    def test_patch(self):
        config_data = config.parse(['--db=sqlite://localhost/test.db',
                                    '--lang=en',
                                    '--django-version=1.8',
                                    '--cms-version=3.2', '--timezone=Europe/Moscow',
                                    '-f', '-q', '-u', '-zno', '--i18n=no',
                                    '-p' + self.project_dir, 'example_path_patch'])
        install.requirements(config_data.requirements)
        django.create_project(config_data)
        django.patch_settings(config_data)
        django.copy_files(config_data)
        settings = open(config_data.settings_path).read()
        urlconf = open(config_data.urlconf_path).read()

        # settings is importable even in non django environment
        sys.path.append(config_data.project_directory)

        project = __import__(config_data.project_name, globals(), locals(), [str('settings')])

        # checking for django options
        self.assertFalse(project.settings.USE_L10N)
        self.assertFalse(project.settings.USE_TZ)
        self.assertEqual(project.settings.TIME_ZONE, 'Europe/Moscow')
        self.assertEqual(project.settings.LANGUAGE_CODE, 'en')
        self.assertTrue(project.settings.MEDIA_ROOT,
                        os.path.join(config_data.project_directory, 'media'))
        self.assertEqual(project.settings.MEDIA_URL, '/media/')
        #
        # checking for standard CMS settings
        self.assertTrue(
            'sekizai.context_processors.sekizai' in
            project.settings.TEMPLATES[0]['OPTIONS']['context_processors']
        )
        self.assertTrue(
            'cms.middleware.toolbar.ToolbarMiddleware' in project.settings.MIDDLEWARE_CLASSES
        )
        self.assertTrue(project.settings.CMS_LANGUAGES['default']['redirect_on_fallback'])
        self.assertEqual(project.settings.CMS_LANGUAGES[1][0]['code'], 'en')

        # checking mptt / treebeard
        self.assertFalse('mptt' in project.settings.INSTALLED_APPS)
        self.assertTrue('treebeard' in project.settings.INSTALLED_APPS)

        # checking for filer (optional) settings
        self.assertTrue('filer' in project.settings.INSTALLED_APPS)
        self.assertTrue('easy_thumbnails' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_image' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_file' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_folder' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_link' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_utils' in project.settings.INSTALLED_APPS)
        self.assertTrue('cmsplugin_filer_video' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_text_ckeditor' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_admin_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('filer' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_file' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_flash' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_googlemap' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_inherit' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_link' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_picture' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_style' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_teaser' not in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_video' in project.settings.INSTALLED_APPS)
        self.assertTrue('djangocms_column' in project.settings.INSTALLED_APPS)
        self.assertTrue(hasattr(project.settings, 'THUMBNAIL_PROCESSORS'))
        self.assertTrue(
            'cms.context_processors.cms_settings' in
            project.settings.TEMPLATES[0]['OPTIONS']['context_processors']
        )
        self.assertTrue(
            'cms.context_processors.media' not in
            project.settings.TEMPLATES[0]['OPTIONS']['context_processors']
        )

        # basic urlconf check
        self.assertTrue('cms.urls' in urlconf)
        self.assertTrue('staticfiles_urlpatterns' in urlconf)

        sys.path.remove(config_data.project_directory)
        del project
        del (sys.modules["%s.settings" % config_data.project_name])