Added unit tests for temp file handling