示例#1
0
    def test_config_written_with_dict(self):
        from tekore.util import config
        written = {config.client_secret_var: 'secret'}

        config_to_file(self.test_config_path, written)
        loaded = config_from_file(self.test_config_path)
        self.assertTupleEqual((None, 'secret', None), loaded)
示例#2
0
 def test_existing_configuration_preserved(self):
     self._write_default()
     config_to_file(self.test_config_path, ('a', 'b', 'c'))
     text = self.test_config_path.read_text()
     self.assertTupleEqual(
         (True, True, True),
         tuple(i in text for i in ('SOMETHING', 'WHATEVER', 'SECTION')))
示例#3
0
    def test_config_tuple_nones_not_written(self):
        original = ('id', 'secret', 'uri')
        config_to_file(self.test_config_path, original)

        written = (None, 'another', None)
        config_to_file(self.test_config_path, written)

        loaded = config_from_file(self.test_config_path)
        self.assertTupleEqual(('id', 'another', 'uri'), loaded)
示例#4
0
 def test_config_written_with_tuple_refresh_token(self):
     written = ('id', 'secret', 'uri', 'refresh')
     config_to_file(self.test_config_path, written)
     loaded = config_from_file(self.test_config_path, return_refresh=True)
     self.assertTupleEqual(written, loaded)
示例#5
0
 def test_config_write_to_section(self):
     written = ('id', 'secret', 'uri')
     config_to_file(self.test_config_path, written, section='SEC')
     loaded = config_from_file(self.test_config_path, section='SEC')
     self.assertTupleEqual(written, loaded)
示例#6
0
 def test_config_written_with_tuple(self):
     written = ('id', 'secret', 'uri')
     config_to_file(self.test_config_path, written)
     loaded = config_from_file(self.test_config_path)
     self.assertTupleEqual(written, loaded)
示例#7
0
 def test_pathlib_path_accepted(self):
     config_to_file(self.test_config_path, ('a', 'b', 'c'))