Factorized out temporary file creation.

This way, this can be mocked.
Factorized out the removal of temporary file

So it can be mocked too.
Added tests for Changelist creation