added test and validations for post controller