'Test that directories can be created if they don\'t exist.'

@mock.patch('certbot.storage.relevant_values')
def test_new_lineage_nonexistent_dirs(self, mock_rv):

    mock_rv.side_effect = (lambda x: x)
    from certbot import storage
    shutil.rmtree(self.config.renewal_configs_dir)
    shutil.rmtree(self.config.default_archive_dir)
    shutil.rmtree(self.config.live_dir)
    storage.RenewableCert.new_lineage('the-lineage.com', 'cert2', 'privkey2', 'chain2', self.config)
    self.assertTrue(os.path.exists(os.path.join(self.config.renewal_configs_dir, 'the-lineage.com.conf')))
    self.assertTrue(os.path.exists(os.path.join(self.config.live_dir, 'the-lineage.com', 'privkey.pem')))
    self.assertTrue(os.path.exists(os.path.join(self.config.default_archive_dir, 'the-lineage.com', 'privkey1.pem')))
