Beispiel #1
0
    def test_transpose_parameters_into_template(self):
        self.maxDiff = None
        template = "kinto.tpl"
        dest = tempfile.mktemp()
        config.render_template(
            template,
            dest,
            host="127.0.0.1",
            secret="secret",
            storage_backend="storage_backend",
            cache_backend="cache_backend",
            permission_backend="permission_backend",
            storage_url="storage_url",
            cache_url="cache_url",
            permission_url="permission_url",
            kinto_version="kinto_version",
            config_file_timestamp="config_file_timestamp",
        )

        with codecs.open(dest, "r", encoding="utf-8") as d:
            destination_temp = d.read()

        sample_path = os.path.join(os.path.dirname(__file__),
                                   "test_configuration/test.ini")
        with codecs.open(sample_path, "r", encoding="utf-8") as c:
            sample = c.read()

        self.assertEqual(destination_temp, sample)
Beispiel #2
0
    def test_transpose_parameters_into_template(self):
        self.maxDiff = None
        template = "kinto.tpl"
        dest = tempfile.mktemp()
        config.render_template(
            template,
            dest,
            host="127.0.0.1",
            secret="secret",
            storage_backend="storage_backend",
            cache_backend="cache_backend",
            permission_backend="permission_backend",
            storage_url="storage_url",
            cache_url="cache_url",
            permission_url="permission_url",
            kinto_version="kinto_version",
            config_file_timestamp="config_file_timestamp",
        )

        with codecs.open(dest, "r", encoding="utf-8") as d:
            destination_temp = d.read()

        sample_path = os.path.join(os.path.dirname(__file__), "test_configuration/test.ini")
        with codecs.open(sample_path, "r", encoding="utf-8") as c:
            sample = c.read()

        self.assertEqual(destination_temp, sample)
Beispiel #3
0
    def test_transpose_parameters_into_template(self):
        self.maxDiff = None
        template = "kinto.tpl"
        dest = tempfile.mktemp()
        config.render_template(template,
                               dest,
                               host='127.0.0.1',
                               secret='secret',
                               storage_backend='storage_backend',
                               cache_backend='cache_backend',
                               permission_backend='permission_backend',
                               storage_url='storage_url',
                               cache_url='cache_url',
                               permission_url='permission_url',
                               kinto_version='kinto_version',
                               config_file_timestamp='config_file_timestamp')

        with codecs.open(dest, 'r', encoding='utf-8') as d:
            destination_temp = d.read()

        sample_path = os.path.join(os.path.dirname(__file__),
                                   "test_configuration/test.ini")
        with codecs.open(sample_path, 'r', encoding='utf-8') as c:
            sample = c.read()

        self.assertEqual(destination_temp, sample)
Beispiel #4
0
    def test_transpose_parameters_into_template(self):
        self.maxDiff = None
        template = "kinto.tpl"
        dest = tempfile.mktemp()
        config.render_template(template, dest,
                               host='127.0.0.1',
                               secret='secret',
                               storage_backend='storage_backend',
                               cache_backend='cache_backend',
                               permission_backend='permission_backend',
                               storage_url='storage_url',
                               cache_url='cache_url',
                               permission_url='permission_url',
                               kinto_version='kinto_version',
                               config_file_timestamp='config_file_timestamp')

        with codecs.open(dest, 'r', encoding='utf-8') as d:
            destination_temp = d.read()

        sample_path = os.path.join(os.path.dirname(__file__),
                                   "test_configuration/test.ini")
        with codecs.open(sample_path, 'r', encoding='utf-8') as c:
            sample = c.read()

        self.assertEqual(destination_temp, sample)
Beispiel #5
0
    def test_create_destination_directory(self):
        dest = os.path.join(tempfile.mkdtemp(), 'config', 'kinto.ini')

        config.render_template("kinto.tpl", dest,
                               secret='secret',
                               storage_backend='storage_backend',
                               cache_backend='cache_backend',
                               permission_backend='permission_backend',
                               storage_url='storage_url',
                               cache_url='cache_url',
                               permission_url='permission_url')

        self.assertTrue(os.path.exists(dest))
Beispiel #6
0
 def test_render_template_creates_directory_if_necessary(self):
     temp_path = tempfile.mkdtemp()
     destination = os.path.join(temp_path, 'config/kinto.ini')
     config.render_template('kinto.tpl', destination, **{
         'secret': "abcd-ceci-est-un-secret",
         'storage_backend': 'cliquet.storage.memory',
         'cache_backend': 'cliquet.cache.memory',
         'permission_backend': 'cliquet.permission.memory',
         'storage_url': '',
         'cache_url':  '',
         'permission_url': ''
     })
     self.assertTrue(os.path.exists(destination))
Beispiel #7
0
    def test_create_destination_directory(self):
        dest = os.path.join(tempfile.mkdtemp(), 'config', 'kinto.ini')

        render_template("kinto.tpl",
                        dest,
                        secret='secret',
                        storage_backend='storage_backend',
                        cache_backend='cache_backend',
                        permission_backend='permission_backend',
                        storage_url='storage_url',
                        cache_url='cache_url',
                        permission_url='permission_url')

        self.assertTrue(os.path.exists(dest))
Beispiel #8
0
 def test_render_template_works_with_file_in_cwd(self):
     temp_path = tempfile.mkdtemp()
     os.chdir(temp_path)
     config.render_template(
         'kinto.tpl', 'kinto.ini', **{
             'secret': "abcd-ceci-est-un-secret",
             'storage_backend': 'cliquet.storage.memory',
             'cache_backend': 'cliquet.cache.memory',
             'permission_backend': 'cliquet.permission.memory',
             'storage_url': '',
             'cache_url': '',
             'permission_url': ''
         })
     self.assertTrue(os.path.exists(os.path.join(temp_path, 'kinto.ini')))
Beispiel #9
0
 def test_render_template_creates_directory_if_necessary(self):
     temp_path = tempfile.mkdtemp()
     destination = os.path.join(temp_path, 'config/kinto.ini')
     config.render_template(
         'kinto.tpl', destination, **{
             'secret': "abcd-ceci-est-un-secret",
             'storage_backend': 'cliquet.storage.memory',
             'cache_backend': 'cliquet.cache.memory',
             'permission_backend': 'cliquet.permission.memory',
             'storage_url': '',
             'cache_url': '',
             'permission_url': ''
         })
     self.assertTrue(os.path.exists(destination))
Beispiel #10
0
 def test_render_template_works_with_file_in_cwd(self):
     temp_path = tempfile.mkdtemp()
     os.chdir(temp_path)
     config.render_template('kinto.tpl', 'kinto.ini', **{
         'secret': "abcd-ceci-est-un-secret",
         'storage_backend': 'cliquet.storage.memory',
         'cache_backend': 'cliquet.cache.memory',
         'permission_backend': 'cliquet.permission.memory',
         'storage_url': '',
         'cache_url':  '',
         'permission_url': ''
     })
     self.assertTrue(os.path.exists(
         os.path.join(temp_path, 'kinto.ini')
     ))
Beispiel #11
0
    def test_create_destination_directory(self):
        dest = os.path.join(tempfile.mkdtemp(), 'config', 'kinto.ini')

        config.render_template("kinto.tpl", dest,
                               host='127.0.0.1',
                               secret='secret',
                               storage_backend='storage_backend',
                               cache_backend='cache_backend',
                               permission_backend='permission_backend',
                               storage_url='storage_url',
                               cache_url='cache_url',
                               permission_url='permission_url',
                               kinto_version='kinto_version',
                               config_file_timestamp='config_file_timestamp')

        self.assertTrue(os.path.exists(dest))
Beispiel #12
0
 def test_render_template_works_with_file_in_cwd(self):
     temp_path = tempfile.mkdtemp()
     os.chdir(temp_path)
     config.render_template(
         "kinto.tpl", "kinto.ini", **{
             "host": "127.0.0.1",
             "secret": "abcd-ceci-est-un-secret",
             "storage_backend": "kinto.core.storage.memory",
             "cache_backend": "kinto.core.cache.memory",
             "permission_backend": "kinto.core.permission.memory",
             "storage_url": "",
             "cache_url": "",
             "permission_url": "",
             "kinto_version": "",
             "config_file_timestamp": "",
         })
     self.assertTrue(os.path.exists(os.path.join(temp_path, "kinto.ini")))
Beispiel #13
0
    def test_create_destination_directory(self):
        dest = os.path.join(tempfile.mkdtemp(), "config", "kinto.ini")

        config.render_template(
            "kinto.tpl",
            dest,
            host="127.0.0.1",
            secret="secret",
            storage_backend="storage_backend",
            cache_backend="cache_backend",
            permission_backend="permission_backend",
            storage_url="storage_url",
            cache_url="cache_url",
            permission_url="permission_url",
            kinto_version="kinto_version",
            config_file_timestamp="config_file_timestamp",
        )

        self.assertTrue(os.path.exists(dest))
Beispiel #14
0
    def test_create_destination_directory(self):
        dest = os.path.join(tempfile.mkdtemp(), "config", "kinto.ini")

        config.render_template(
            "kinto.tpl",
            dest,
            host="127.0.0.1",
            secret="secret",
            storage_backend="storage_backend",
            cache_backend="cache_backend",
            permission_backend="permission_backend",
            storage_url="storage_url",
            cache_url="cache_url",
            permission_url="permission_url",
            kinto_version="kinto_version",
            config_file_timestamp="config_file_timestamp",
        )

        self.assertTrue(os.path.exists(dest))
Beispiel #15
0
 def test_render_template_works_with_file_in_cwd(self):
     temp_path = tempfile.mkdtemp()
     os.chdir(temp_path)
     config.render_template(
         "kinto.tpl",
         "kinto.ini",
         **{
             "host": "127.0.0.1",
             "secret": "abcd-ceci-est-un-secret",
             "storage_backend": "kinto.core.storage.memory",
             "cache_backend": "kinto.core.cache.memory",
             "permission_backend": "kinto.core.permission.memory",
             "storage_url": "",
             "cache_url": "",
             "permission_url": "",
             "kinto_version": "",
             "config_file_timestamp": "",
         }
     )
     self.assertTrue(os.path.exists(os.path.join(temp_path, "kinto.ini")))