refactor tests and add admin tests