Esempio n. 1
0
    def test_build_settings(self):
        """Tests django.__init__._build_settings function."""
        dj_version, dj_match = get_stable_django()
        cms_stable, cms_match = get_stable_djangocms()

        config_data = config.parse([
            "--db=postgres://user:pwd@host:5432/dbname",
            "--cms-version=%s" % cms_stable,
            "--django=%s" % dj_version,
            "-q",
            "-p .",
            "example_prj",
        ])
        settings = django._build_settings(config_data)
        self.assertTrue(
            textwrap.dedent("""
            DATABASES = {
                'default': {
                    'CONN_MAX_AGE': 0,
                    'ENGINE': 'django.db.backends.postgresql_psycopg2',
                    'HOST': 'host',
                    'NAME': 'dbname',
                    'PASSWORD': '******',
                    'PORT': 5432,
                    'USER': '******'
                }
            }""").strip() in settings)
        self.assertTrue("X_FRAME_OPTIONS = 'SAMEORIGIN'" in settings)
Esempio n. 2
0
 def test_build_settings(self):
     """Tests django.__init__._build_settings function."""
     config_data = config.parse(['--db=postgres://user:pwd@host:5432/dbname',
                                 '--cms-version=stable', '--django=%s' % dj_ver,
                                 '-q', '-p .', 'example_prj'])
     settings = django._build_settings(config_data)
     self.assertTrue(textwrap.dedent('''
         DATABASES = {
             'default': {
                 'ENGINE': 'django.db.backends.postgresql_psycopg2',
                 'HOST': 'host',
                 'NAME': 'dbname',
                 'PASSWORD': '******',
                 'PORT': '5432',
                 'USER': '******'
             }
         }''').strip() in settings)
 def test_build_settings(self):
     """Tests django.__init__._build_settings function."""
     config_data = config.parse([
         '--db=postgres://user:pwd@host:5432/dbname',
         '--cms-version=stable',
         '--django=%s' % dj_ver, '-q', '-p .', 'example_prj'
     ])
     settings = django._build_settings(config_data)
     self.assertTrue(
         textwrap.dedent('''
         DATABASES = {
             'default': {
                 'ENGINE': 'django.db.backends.postgresql_psycopg2',
                 'HOST': 'host',
                 'NAME': 'dbname',
                 'PASSWORD': '******',
                 'PORT': '5432',
                 'USER': '******'
             }
         }''').strip() in settings)
Esempio n. 4
0
    def test_build_settings(self):
        """Tests django.__init__._build_settings function."""
        dj_version, dj_match = get_latest_django(latest_stable=True)
        cms_stable, cms_match = get_latest_djangocms()

        config_data = config.parse(['--db=postgres://user:pwd@host:5432/dbname',
                                    '--cms-version=%s' % cms_stable, '--django=%s' % dj_version,
                                    '-q', '-p .', 'example_prj'])
        settings = django._build_settings(config_data)
        self.assertTrue(textwrap.dedent('''
            DATABASES = {
                'default': {
                    'CONN_MAX_AGE': 0,
                    'ENGINE': 'django.db.backends.postgresql_psycopg2',
                    'HOST': 'host',
                    'NAME': 'dbname',
                    'PASSWORD': '******',
                    'PORT': 5432,
                    'USER': '******'
                }
            }''').strip() in settings)
        self.assertTrue('X_FRAME_OPTIONS = \'SAMEORIGIN\'' in settings)