Moved posts API out of post module file, rewrote some post tests