'Creates a OLI configuration file
It is created in testdir (so create_test_dir has to be called
earlier) using the credentials information given (so they had
to be set earlier). Failure to do either of them will raise an
AssertionException. If config is None, a default one will be
used via get_default_config, otherwise it needs to be a config
object derived from that.'

@classmethod
def write_config_file(cls, config=None):

    if (config is None):
        config = cls.get_default_config()
    localfolders = os.path.join(cls.testdir, 'mail')
    config.set('Repository    Maildir', 'localfolders', localfolders)
    with open(os.path.join(cls.testdir, 'offlineimap.conf'), 'wt') as f:
        config.write(f)
