Refactor stash api tests