tests: replace log with log_handle
tests: add tests for helper functions